Skip to content

Instantly share code, notes, and snippets.

@OrangeCrush
OrangeCrush / Upload_ssh_key.sh
Last active December 11, 2015 16:08
I use this so much to upload keys and it's a pain to go out on the net and look for it each time
cat ~/.ssh/id_rsa.pub | ssh user@hostname "mkdir .ssh; cat >> ~/.ssh/authorized_keys"
@OrangeCrush
OrangeCrush / cut_audio.sh
Created January 29, 2013 03:50
Cutting Audio -ss will be the start time, and -t <seconds> will be how long the sound runs until it is cut off. This is not destructive.
ffmpeg -ss 00:00:00.00 -t 189 -i song.mp3 -acodec copy new_song.mp3
@OrangeCrush
OrangeCrush / ssh-agent
Created February 26, 2013 01:11
Load ssh key into memory
eval `ssh-agent`
ssh-add
@OrangeCrush
OrangeCrush / top100.sh
Created May 19, 2013 20:29
Top 100 commands!
history | sed "s/^[0-9 ]*//" | sed "s/ *| */\n/g" | awk '{print $1}' | sort | uniq -c | sort -rn | head -n 100 > commands.txt
@OrangeCrush
OrangeCrush / xclip.sh
Created June 30, 2013 18:36
Terminal output to clipboard
xclip -sel clip < file
@OrangeCrush
OrangeCrush / json_deck.rb
Created July 20, 2013 19:12
Quick deck of cards in JSON.
#Build a deck of cards in json
require 'json'
class Card
attr_reader :value, :suit
def initialize(val,suit)
@value = val
@suit = suit
end
@OrangeCrush
OrangeCrush / fix_up_arrow.zsh
Created July 20, 2013 22:42
Fixes up arrow backwards history search on Debian systems
echo "DEBIAN_PREVENT_KEYBOARD_CHANGES=yes" >> ~/.zshenv
@OrangeCrush
OrangeCrush / gist:6630435
Created September 19, 2013 21:57
Useful for data mining this site lol
http://worddetail.org/most_common/nouns/4
$(".boxtable > table > tbody > tr > td > a").each(function(_,val){console.log($(val).text())});
@OrangeCrush
OrangeCrush / Main.java
Last active December 25, 2015 05:59
Solution to ACM programming problem with the test questions. To run this do (unix) $ javac Main.java && java Main
/*
* Max F
* Run with
* $ javac Main.java && java Main
* 90 (desired score)
* 4 (num exams)
* 25 25 25 25 (weight of each)
* 80 80 80 (scores on each exam before final)
*
*/
@OrangeCrush
OrangeCrush / gist:7036141
Last active December 25, 2015 20:38
Get the 100 most interesting three word phrases http://brainz.org/100-best-3-word-phrases/
for(var i=2; i < 100; i++){console.log((/\".*\"/g).exec($($('.entry')[0].children[i]).text())[0].slice(1,(/\".*\"/g).exec($($('.entry')[0].children[i]).text())[0].length -1))}