Skip to content

Instantly share code, notes, and snippets.

View jyurek's full-sized avatar

Jon Yurek jyurek

View GitHub Profile
@jyurek
jyurek / palette
Last active October 2, 2015 19:32
A small bash script for outputting the most used 5 colors in an image.
#!/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 February 12, 2024 10:37
Create and switch sessions in tmux quickly
#!/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

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:

[26] pry(#<RSpec::Core::ExampleGroup::Nested_1::Nested_20>)> MIME::Types["text/plain"].first.extensions
=> ["doc"]
@jyurek
jyurek / lt
Created October 7, 2013 14:53
Useful command for getting large type
#!/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
irb(main):001:0> "hello"f.object_id
=> 70108391341300
irb(main):002:0> "hello"f.object_id
=> 70108391341300
@jyurek
jyurek / recipe
Created January 30, 2013 15:38
Chicken Paprikash
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 14:33
rbenv doesn't work for me.
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'
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 19:17
A bash prompt with useful information, including popping up a growl notification when commands are done.
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