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
// ==UserScript== | |
// @name LGTM Button | |
// @namespace lgtm.github.com | |
// @description Add a LGTM button to pull requests. | |
// @include https://github.com/Skookum/*/pull/* | |
// @version 1 | |
// ==/UserScript== | |
var lgtmButton = document.createElement('button'), | |
buttonCont = document.querySelector('button[name="comment_and_close"]').parentNode, | |
commentBtn = buttonCont.querySelector('button:last-child'); |
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
class TrueClass | |
def to_i | |
1 | |
end | |
end | |
class FalseClass | |
def to_i | |
0 | |
end |
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
_hcl () { | |
local cur prev opts cmds tasks | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
opts="--help --version" | |
cmds="show tasks aliases set unset start stop resume note" | |
if [[ ${cur} == -* ]] ; then | |
COMPREPLY=($(compgen -W "${opts}" -- ${cur})) |
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
def run_concurrently(title, jobs, &block) | |
mutex = Mutex.new | |
work = Queue.new | |
jobs.each {|j| work << j} | |
pbar = ProgressBar.create(title: title, total: jobs.length, format: '%a |%w>%i| %e %t') | |
threads = 4.times.map do | |
Thread.new do | |
loop do | |
block.call(work.pop(:nonblocking)) | |
mutex.synchronize { pbar.increment } |
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
#!/usr/bin/bash | |
while read f | |
do | |
echo "$(git log --format="%at" --reverse "$f" | head -n1) --> $f" | |
done | sort -n |
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_relative './text_effect' | |
fonts = %w(Courier Helvetica Times-Roman Arial-Regular Consolas-Regular | |
Inconsolata-Medium Times-New-Roman-Regular Verdana-Regular) | |
effects = [:arc, :taper, :concave, :pinch, :bulge, :ramp, :wedge, :normal] | |
fonts.product(effects).each do |font, effect| | |
File.open("#{font}-#{effect}.svg", "w") do |f| | |
f.write TextEffect.new('Hello World!', font, effect) |
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
#!/usr/bin/bash | |
ssh new.jroes.net 'cat /dev/null > ~/.the-ding && tail -f ~/.the-ding' | while read hit | |
do | |
mplayer -really-quiet -noar /usr/share/sounds/gnome/default/alerts/glass.* &> /dev/null | |
done |
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
h = Hash.new do |h,k| | |
l = h.keys.select {|i| i < k}.max | |
h[l] | |
end | |
h[1] = :foo | |
h[5] = :bar | |
h[3] # => :foo |
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
#!/usr/bin/bash | |
git remote prune origin | |
git branch | grep -v master$ | cut -d' ' -f3 | while read b; do echo "$b == $(git branch -r | grep $b)"; done | grep '== $' | cut -d' ' -f1 | xargs -n1 git branch -d | |
git gc |
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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use POSIX qw(setsid); | |
&daemonize; | |
exec("mplayer -really-quiet -noar /usr/share/sounds/gnome/default/alerts/glass.* &> /dev/null"); | |
sub daemonize { | |
chdir '/' or die "Can't chdir to /: $!"; |