Skip to content

Instantly share code, notes, and snippets.

echo "#\!/usr/bin/env python\nhbd = lambda x:\"\".join([chr(int(''.join(c), 16)) for c in zip(x[0::2],x[1::2])])\n\nprint(hbd(\"48617070792042697274686461792c204e65726421\"))" > hbd.py
chmod +x hbd.py
./hbd.py
#!/bin/bash
#sets the victims desktop to beiber.
/usr/bin/curl https://gist.githubusercontent.com/jgagner/9393470/raw/6ea21b41c27f22cd9fd50d7659ab314b8bfd8403/belieber.jpg > /tmp/belieber.jpg.base64
/usr/bin/base64 -D --input /tmp/belieber.jpg.base64 -o ~/belieber.jpg
/usr/bin/osascript -e "tell application \"System Events\" to set picture of every desktop to \"~/belieber.jpg\""
@jgagner
jgagner / belieber.jpg
Created March 6, 2014 16:26
belieber.jpg
/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIBgcJBwYGCAsICQoKCgoKBggLDAsKDAkKCgoBAgICAgICBQMDBQoHBgcKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCv/AABEIATsDUgMBEQACEQEDEQH/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+gEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoLEQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/AP34oAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgB4+5+FAEUnagDj/jS0lt4Evr+AZkjt22/kaAP5p/26fFl9f/tB63NfjHlyyY+X0dqAPjT4z6lc+Jpp41/1aEgnFAHj82nzNrsVjEhOWHagD1/wp4HENvHcXHG0
@jgagner
jgagner / gist:5809237
Created June 18, 2013 20:50
Ordering du by size. Found on the internet here http://ubuntuforums.org/showthread.php?t=885344
du -k * | sort -nr | cut -f2 | xargs -d '\n' du -sh | less
#mostly pseudo-code
#LOLOLOL
class Module
alias_method :old_method_missing, :method_missing
def method_missing(methId)
methods = methId.split("_")
tmp = self
while methods.size > 0
my_meth = methods.pop
#doesn't accept args for the methods... probably next on that
class Object
def try_chain(*args)
method = args.shift
if respond_to?(method)
args.empty? ? self.send(method) : self.send(method).try_chain(*args)
else
nil
end
end
def do_something &block
(1..4).zip([:a,:b,:c,:d]).zip((["face"] * 4).map {|x| x.to_sym}).transpose[0].transpose[0].each(&block)
end
do_something { puts "face!"}
There are four ways to do something
<ul>
<% (1..4).zip([:a,:b,:c,:d]).zip(["face1","face2","face3","face4"]).transpose[0].transpose[0].each do |x| %>
<li><%= x %> </li>
<% end %>
</ul>
//Squished a couple files together
package com.jeromegagner.example.trees.binary;
/**
* Created by IntelliJ IDEA.
* User: jgagner
* Date: Apr 18, 2010
* Time: 1:30:24 PM
* To change this template use File | Settings | File Templates.
#Output
#Jerome-Gagners-MacBook-Pro:amazon jgagner$ ruby bids.rb
#Current bid: 6, bid total 6, current max 0
#Current bid: 6, bid total 12, current max 6
#Current bid: 6, bid total 18, current max 12
#Current bid: 3, bid total 12, current max 18
#Accepted bids = 666 at 18
#Current bid: 6, bid total 6, current max 0
#Current bid: 5, bid total 10, current max 6
#Current bid: 4, bid total 12, current max 10