Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Save your tab history once you've reached a state
# where too many windows/tabs are open. ^^
DATE=$(date "+%Y%m%d%H%M%S")
SAFARI_TABS_DB="$HOME/Library/Containers/com.apple.Safari/Data/Library/Safari/SafariTabs.db"
sqlite3 "$SAFARI_TABS_DB" <<EOF
.headers ON
# Remove formulae which are dependencies from the Brewfile
# As crafted by @stealthybox: https://github.com/Homebrew/homebrew-bundle/issues/236#issuecomment-437644953
cat ~/Brewfile | egrep "$(brew leaves | xargs printf '"%s"|')tap|cask|mas"
# list merge commits between HEAD and the last tag
git log --merges $(git describe --abbrev=0)..HEAD --format=%s
# compare changes between the last two tags
# note: HEAD must be at least "equal" to the most recent tag
git diff -w $(git describe --abbrev=0 $(git rev-list --tags --max-count=2 | tail -n 1))..$(git describe --abbrev=0)
# create a remote counterpart and name it after the current branch
git push -u origin $(git branch --show-current)
module HashDecorator
def deep_symbolize_keys
each.with_object({}) do |(k, v), new_hash|
new_hash[k.to_sym] =
case v
when Hash then v.deep_symbolize_keys
when Array then v.deep_symbolize_elements
else v
end
end
ffmpeg -i ~/Desktop/Screen\ Recording\ 2021-01-20\ at\ 10.53.21.mov -vcodec libx265 -crf 28 ~/Desktop/Screen\ Recording\ 2021-01-20\ at\ 10.53.21.mp4
ffmpeg -i /Users/jcsanti/Desktop/Screen\ Recording\ 2020-11-27\ at\ 10.04.15.mov -vf "fps=10,scale=900:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 /Users/jcsanti/Desktop/new_gif_from_screen_recording.gif
CREATE TABLE reservation (room int, during tsrange);
INSERT INTO reservation VALUES
(1108, '[2010-01-01 14:30, 2010-01-01 15:30)')
,(1108, '[2010-01-01 15:00, 2010-01-01 16:30)');
CREATE FUNCTION tsrange_union_accum(tsrange, tsrange)
RETURNS tsrange
AS 'SELECT $1 + $2'
LANGUAGE SQL
IMMUTABLE
{*,.*}~log/**~tmp/**~coverage/**~public/assets/**~assets/images/**
class Person
KEYWORD_ARGS = [:name, :age].freeze
class_eval(%Q{
def initialize(#{KEYWORD_ARGS.map { |kw| "#{kw}:" }.join(', ')})
#{KEYWORD_ARGS.map { |kw| "instance_variable_set(\"@#{kw.to_s}\", #{kw})" }.join("\n")}
end
})
def self_introduction