This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function jj-latest-description --description "Get latest non-empty commit description and bookmarks" | |
jj log -r 'latest(ancestors(@, 10) ~ (empty()~merges()))' \ | |
--quiet --no-pager --no-graph --ignore-working-copy --color always \ | |
-T "surround('(', ')', separate(' ', \ | |
self.local_bookmarks(), \ | |
coalesce(self.description().first_line(), '...'), \ | |
self.change_id().shortest(5)\ | |
))" 2>/dev/null | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Place me in ~/.config/fish/functions | |
# Then add me to `fish_vcs_prompt`: `funced fish_vcs_prompt` and save it to | |
# your personal config: `funcsave fish_vcs_prompt;` | |
function fish_jj_prompt --description 'Write out the jj prompt' | |
# Is jj installed? | |
if not command -sq jj | |
return 1 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import SwiftUI | |
#if canImport(UIKit) | |
import UIKit | |
#elseif canImport(AppKit) | |
import AppKit | |
#endif | |
extension Image { | |
/// Initializes a SwiftUI `Image` from data. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/swift | |
// | |
// - This is just some AppKit boilerplate to launch a window. | |
// | |
import AppKit | |
@available(OSX 10.15, *) | |
class AppDelegate: NSObject, NSApplicationDelegate { | |
let window = NSWindow() | |
let windowDelegate = WindowDelegate() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env xcrun -sdk macosx swift | |
// Displays UI in an NSWindow which can interact with the commandline | |
// Usage: `echo "Bar" | ./swift-ui-commandline-tool.swift` | |
import Foundation | |
import SwiftUI | |
extension CommandLine { | |
static let input: String = { AnyIterator { readLine() }.joined() }() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'); | |
const server = http.createServer(); | |
server.on('request', (request, response) => { | |
let body = []; | |
request.on('data', (chunk) => { | |
body.push(chunk); | |
}).on('end', () => { | |
body = Buffer.concat(body).toString(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo rm -rfv /Library/Caches/com.apple.iconservices.store; sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; ; sleep 3;sudo touch /Applications/* ; killall Dock; killall Finder |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Glibc | |
var action = posix_spawn_file_actions_t() | |
posix_spawn_file_actions_init(&action); | |
defer { posix_spawn_file_actions_destroy(&action) } | |
posix_spawn_file_actions_addopen(&action, 1, "/tmp/foo-log", (O_WRONLY | O_CREAT | O_TRUNC), 0644) | |
posix_spawn_file_actions_adddup2(&action, 1, 2) | |
let args = [ | |
"ffmpeg", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh [email protected] "ffmpeg -i $URL -c copy -f nut pipe:1" | ffplay -i pipe:0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local _M = {} | |
function _M.getHostname() | |
local f = io.popen ("/bin/hostname") | |
local hostname = f:read("*a") or "" | |
f:close() | |
hostname =string.gsub(hostname, "\n$", "") | |
return hostname | |
end | |
return _M |
NewerOlder