This file contains 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
# detects whether a terminal is dark-on-light or light-on-dark. | |
# Only purposefully supports Terminal.app and iTerm, but a bunch of things use | |
# $COLORFGBG. | |
module BackgroundDetector | |
DARK = :dark | |
LIGHT = :light | |
def terminal_app | |
theme = `/usr/libexec/PlistBuddy -c "Print :'Default Window Settings'" ~/Library/Preferences/com.apple.Terminal.plist`.chomp | |
blob = `/usr/libexec/PlistBuddy -c "Print :'Window Settings':'#{theme}':BackgroundColor" ~/Library/Preferences/com.apple.Terminal.plist`.chomp |
This file contains 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
# | |
# Step 1: | |
# | |
# FlameGraph.generate(output: 'asdf') { ... }, | |
# | |
# Step 2: | |
# | |
# git clone https://github.com/brendangregg/FlameGraph | |
# cd FlameGraph | |
# ./flamegraph.pl < ../asdf > out.svg |
This file contains 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
#pragma D option dynvarsize=32M | |
#pragma D option switchrate=1msec | |
#pragma D option bufsize=25m | |
#pragma D option quiet | |
syscall::open:entry /pid == $target/ { self->path = arg0; } | |
syscall::shm_open:entry /pid == $target/ { self->path = arg0; } | |
syscall::open_extended:entry /pid == $target/ { self->path = arg0; } | |
syscall::accept:entry /pid == $target/ { self->fd = arg0; } | |
syscall::accept_nocancel:entry /pid == $target/ { self->fd = arg0; } |
This file contains 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
require 'openssl' | |
k = OpenSSL::PKey::EC.new('secp384r1').generate_key | |
p = OpenSSL::PKey::EC.new(k.public_key.group) | |
p.public_key = k.public_key | |
puts k.to_pem, p.to_pem |
- Build app like this
- Open app
open omgscheme://whatever
This file contains 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
-- compiled from https://github.com/janko-m/vim-test/tree/master/bin | |
on run argv | |
set command to argv | |
-- without doing this as a var, it will launch iterm2 | |
set iterm to "iTerm2" | |
if application iterm is running then | |
tell application "iTerm" | |
set _window to (current window) | |
if _window is equal to missing value then |
This file contains 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
# Contributor: Burke Libbey <burke@libbey.me> | |
# Maintainer: | |
pkgname=runc | |
pkgver=0.0.4 | |
pkgrel=0 | |
_gitcommit=b0fd9fb7 | |
pkgdesc="CLI tool for spawning and running containers according to the OCF specification" | |
url="http://runc.io/" | |
arch="x86_64" | |
license="ASL 2.0" |
Lots of these commands have two versions: one with and one without a :
. The colon modifies operators to treat a declared-but-empty variable as nonexistent.
More detailed docs and examples for all of these are at: http://www.tldp.org/LDP/abs/html/parameter-substitution.html.
bash | ruby |
---|---|
${a} |
a |
${a-b} |
`a |
${a:-b} |
`(a == "" ? nil : a) |
${a=b} |
`a |