convert image.png -resize 40 txt:-|sed -E 's/://;s/\( ? ?//;s/, ? ?/,/g;s/\)//;s/([0-9]+,[0-9]+,[0-9]+),[0-9]+/\1/g;s/255/254/g;/mage/d'|awk '{print $1,$2}'|sed -E 's/^0,[0-9]+ /print "echo;tput setaf "\;/;s/^[0-9]+,[0-9]+ /print "tput setaf ";/;s/(.+),(.+),(.+)/\1\/42.5*36+\2\/42.5*6+\3\/42.5+16/'|bc|sed 's/$/;echo -n " ";/'|tr '\n' ' '|sed 's/^/tput rev;/;s/; /;/g;s/$/tput sgr0;echo/'|bash
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
~ ➤ ruby-install --jobs=10 ruby 1.9 | |
>>> Installing ruby 1.9.3-p545 into /Users/justin/.rubies/ruby-1.9.3-p545 ... | |
>>> Installing dependencies for ruby 1.9.3-p545 ... | |
Warning: openssl-1.0.1g already installed | |
Warning: readline-6.3.3 already installed | |
Warning: libyaml-0.1.6 already installed | |
Warning: gdbm-1.11 already installed | |
Warning: libffi-3.0.13 already installed | |
>>> Downloading http://cache.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p545.tar.bz2 into /Users/justin/src ... | |
--2014-04-18 18:43:05-- http://cache.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p545.tar.bz2 |
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/env ruby | |
require 'open3' | |
url = `pbpaste`.strip | |
Open3.popen2("pbcopy") do |stdin, stdout, wait_thr| | |
stdin.puts "![](#{url})" | |
end | |
gh pull-request |
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
non_boundary = boundary(this_query_char) do |index,score| | |
if index && score | |
this_score = index + 1 | |
this_score + score | |
end | |
end | |
if non_boundary | |
boundary = boundary(/\b#{this_query_char}/) do |index, score| |
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 'active_support/concern' | |
require 'active_support/core_ext/array/extract_options' | |
module CryptKeeper | |
module Model | |
class WithoutEncrypted | |
def initialize(collection) | |
@collection = collection | |
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
require 'active_support/all' | |
class Rails | |
def self.logger=(logger) | |
@logger = logger | |
end | |
def self.logger | |
@logger | |
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
setw -g mode-keys vi | |
# Tmux conf file to use on OSX machines to get copy and past to work properly | |
set -g default-command "reattach-to-user-namespace -l zsh" | |
# OSX Copy mode | |
bind y run "tmux save-buffer - | reattach-to-user-namespace pbcopy" | |
bind h select-pane -L | |
bind j select-pane -D |
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
# http://henrik.nyh.se/2008/12/git-dirty-prompt | |
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
# username@Machine ~/dev/dir[master]$ # clean working directory | |
# username@Machine ~/dev/dir[master*]$ # dirty working directory | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" |
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
# http://henrik.nyh.se/2008/12/git-dirty-prompt | |
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
# username@Machine ~/dev/dir[master]$ # clean working directory | |
# username@Machine ~/dev/dir[master*]$ # dirty working directory | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" |
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
# Generates a series of substitution cipher puzzles. The messages to | |
# "encrypt" are take from a text file passed on the command-line, | |
# where each message is on one line. | |
# | |
# The output is a PDF, "codes.pdf". | |
# | |
# This was written for my 7 year-old, who loves doing substitution | |
# ciphers. | |
require 'prawn' |
OlderNewer