Skip to content

Instantly share code, notes, and snippets.

Avatar

Jon Yurek jyurek

View GitHub Profile
@jyurek
jyurek / palette
Last active Oct 2, 2015
A small bash script for outputting the most used 5 colors in an image.
View palette
#!/bin/bash
for c in $(convert $1 -colors 5 -depth 8 -format %c histogram:info: | sort -d -r | cut -d '#' -f 2 | cut -d ' ' -f 1); do
colors+=($c)
convert -size 50x50 'canvas:#'$c /tmp/$c.png
done
color_files=
for c in ${colors[@]}; do
color_files="$color_files /tmp/$c.png"
@jyurek
jyurek / tm.sh
Last active Jun 14, 2018
Create and switch sessions in tmux quickly
View tm.sh
#!/bin/sh
tm() {
if [ -z $1 ]; then
tmux switch-client -l
else
if [ -z "$TMUX" ]; then
tmux new-session -As $1
else
if ! tmux has-session -t $1 2>/dev/null; then
TMUX= tmux new-session -ds $1
View keybase.md

Keybase proof

I hereby claim:

  • I am jyurek on github.
  • I am jyurek (https://keybase.io/jyurek) on keybase.
  • I have a public key whose fingerprint is FB6F B8E3 DB7F 794D FCB2 3360 5E88 9106 71F7 F337

To claim this, I am signing this object:

View wat
[26] pry(#<RSpec::Core::ExampleGroup::Nested_1::Nested_20>)> MIME::Types["text/plain"].first.extensions
=> ["doc"]
@jyurek
jyurek / lt
Created Oct 7, 2013
Useful command for getting large type
View lt
#!/usr/bin/osascript
on run argv
set display_string to (item 1 of argv)
tell application "Quicksilver" to show large type display_string
end run
View gist:6670682
irb(main):001:0> "hello"f.object_id
=> 70108391341300
irb(main):002:0> "hello"f.object_id
=> 70108391341300
@jyurek
jyurek / recipe
Created Jan 30, 2013
Chicken Paprikash
View recipe
1 cup onion, diced
3/4 stick butter
2 tsp salt
4 tsp bullion
6 cups water
3 tbsp paprika
4lbs chicken thighs
7 tbsp flour
1 cup plain yogurt (or sour cream, but yogurt is smoother in the end)
@jyurek
jyurek / gist:2595139
Created May 4, 2012
rbenv doesn't work for me.
View gist:2595139
1 Birdhouse:~/Development/project1 jyurek (sandbox1)$ which bundle
/Users/jyurek/.rbenv/shims/bundle
0 Birdhouse:~/Development/project1 jyurek (sandbox1)$ bundle
Fetching source index for http://rubygems.org/
Enter your password to install the bundled RubyGems to your system: #[ <-------- WAT ]
[.. a bunch of gems ...]
Installing linecache19 (0.5.12) /Library/Ruby/Site/1.8/rubygems/installer.rb:388:in `ensure_required_ruby_version_met': linecache19 requires Ruby version >= 1.9.2. (Gem::InstallError)
from /Library/Ruby/Site/1.8/rubygems/installer.rb:156:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/source.rb:101:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
View dimensions_bench.rb
require 'rubygems'
require 'benchmark'
require 'dimensions'
pics = Dir.glob("/Users/jyurek/Pictures/[0-9a-zA-Z]*.*")
Benchmark.bmbm do |x|
x.report('imagemagick') do
pics[0..1000].each{|f| `identify -format '%wx%h' "#{f}" 2>&1`.split("x") }
end
x.report('dimensions') do
@jyurek
jyurek / .bashrc
Created May 19, 2011
A bash prompt with useful information, including popping up a growl notification when commands are done.
View .bashrc
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 | grep \* | awk '{print $2}'
}
function parse_hg_branch {
hg branch 2>/dev/null
You can’t perform that action at this time.