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
#!/opt/homebrew/opt/ruby/bin/ruby | |
# iTerm2 file opener for semantic history | |
# | |
# Setup: iTerm2 » Settings » Profiles » Advanced » Semantic History » Always run command… | |
# Command: /path/to/iterm2-edit \5 \1 | |
# | |
# Parses text selections and opens appropriate handler: | |
# - Text files: $EDITOR with line:col positioning | |
# - Binary files: system default app |
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
[program:fswatch-chmod] | |
# For each changed file: | |
# - skips if not regular file | |
# - skips if no shebang | |
# - finds enclosing git repo (if any) | |
# - skips if file tracked and unchanged in that repo (prevent mangling checkouts / rebases) | |
# - otherwise makes file executable | |
# - ignore files inside .git but allow in .git/hooks/ | |
command=bash -c ' | |
/opt/homebrew/bin/fswatch -v -r ~/bin ~/src --exclude /\.git/ --include /\.git/hooks/ | |
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 ruby | |
# git-reword: Interactive tool for bulk editing commit messages' first line | |
# | |
# Opens the rebase todo sequence for editing, amends any commit messages with | |
# the inline-reworded message. Other rebase operations are performed normally. | |
# | |
# If you reword inline but also use a reword action on the same line, the | |
# inline edit wins. | |
# |
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
# Operating with plain arrays: | |
class Array | |
def scanl(init, &f) | |
return [init] if empty? | |
reduce([init]){ |xs, x| xs << f.(xs.last, x) } | |
end | |
def scanl1(&f) | |
return if empty? # might consider returning [] |
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
// ==UserScript== | |
// @name ⌘⌫ Element | |
// @description ⌘⌫ deletes element under cursor, ⌘Z puts back | |
// @match *://*.* | |
// ==/UserScript== | |
let undoWindow = 3000 // can undo for this long | |
let undoCooldown = 1500 // will prevent default undo for this long after last undo | |
let scheduledDeletion = null // timeout id for deleteElements | |
let lastHide = 0 // timestamp for last element was hidden |
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
// ==UserScript== | |
// @name Youtube ensure HD | |
// @description Sets youtube player to highest resolution if drops from an HD res | |
// @match *://www.youtube.com/watch* | |
// @match *://youtu.be/watch* | |
// ==/UserScript== | |
let intervalID = setInterval(()=> { | |
let qs = (q) => document.querySelector(q) | |
let qsa = (q) => [...document.querySelectorAll(q)] |
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 ruby | |
s = ARGF.read =~ /Freitag, 13. Mai 2016.*?(?=\n\n)/m && $& | |
s.gsub! /^(\d\d)\.(\d\d)\u00A0Uhr\n/, "\\1:\\2h -- " | |
days = [] | |
s.lines.each do |l| | |
case l | |
when /^\d\d:\d\dh -- Einlaß/ then :pass | |
when /Mai 2016$/ then days << [l, []] | |
when /^\d\d:\d\dh -- / then days.last[1] << l.sub(/\Z/, " -- @ #{$x}") |
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
infix operator « { precedence 131 associativity left } | |
func «<A,B,C>(a:A, f:(A,B) -> C) -> B -> C { return { f(a,$0) } } | |
infix operator » { precedence 131 associativity left } | |
func »<B,C>(f:(B) -> C, b:B) -> C { return f(b) } | |
infix operator < { precedence 131 associativity left } | |
func <<A,B,C>(a:A, f:(A,B) -> C) -> B -> C { return { f(a,$0) } } | |
infix operator > { precedence 131 associativity left } |
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
struct Placeholder {} | |
let __ = Placeholder() | |
func partial<A,B,Z>(f:(A,B) -> Z, a:Placeholder, b:B) -> (A) -> Z { return { f($0,b) } } | |
func partial<A,B,Z>(f:(A,B) -> Z, a:A, b:Placeholder) -> (B) -> Z { return { f(a,$0) } } | |
func partial<A,B,C,Z>(f:(A,B,C) -> Z, a:Placeholder, b:B, c:C) -> (A) -> Z { return { f($0,b,c) } } | |
func partial<A,B,C,Z>(f:(A,B,C) -> Z, a:A, b:Placeholder, c:C) -> (B) -> Z { return { f(a,$0,c) } } | |
func partial<A,B,C,Z>(f:(A,B,C) -> Z, a:A, b:B, c:Placeholder) -> (C) -> Z { return { f(a,b,$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
tell application "iTunes" | |
-- this script only makes sense for iTunes radio, so bail if not it | |
if container of current playlist is not equal to source "iTunes Radio" then return | |
-- mute first because ads are so fucking annoying | |
set mute to true | |
-- tracks shorter than this number of seconds should be muted as they're likely ads | |
set _k_mute_threshold to 32 | |
NewerOlder