Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
echo "wut"
@ip2k
ip2k / gist:633c54ae42ce00d995d0
Created May 20, 2014 19:41
Inspect OSX Clipboard
alias pbinspect='pbpaste |hexdump -cC'
12:40 $ pbinspect
0000000 < s c r i p t s r c = " h t t
00000000 3c 73 63 72 69 70 74 20 73 72 63 3d 22 68 74 74 |<script src="htt|
0000010 p s : / / g i s t . g i t h u b
00000010 70 73 3a 2f 2f 67 69 73 74 2e 67 69 74 68 75 62 |ps://gist.github|
0000020 . c o m / i p 2 k / 6 3 3 c 5 4
00000020 2e 63 6f 6d 2f 69 70 32 6b 2f 36 33 33 63 35 34 |.com/ip2k/633c54|
0000030 a e 4 2 c e 0 0 d 9 9 5 d 0 . j
00000030 61 65 34 32 63 65 30 30 64 39 39 35 64 30 2e 6a |ae42ce00d995d0.j|
0000040 s " > < / s c r i p t >
#!/usr/bin/ruby
#
# This script fixes /usr/local only.
#
# 6th January 2010:
# Modified the script to just fix, rather than install. - rpavlik
#
# 30th March 2010:
# Added a check to make sure user is in the staff group. This was a problem
# for me, and I think it was due to me migrating my account over several
@ip2k
ip2k / python_time
Last active August 29, 2015 14:04
#pythonTime
import time, datetime
length=5 # 5 minutes from now
start_time = datetime.datetime.strftime(datetime.datetime.now(), "%Y-%m-%d %H:%M:%S")
stop_time = datetime.datetime.strftime(datetime.datetime.now() + datetime.timedelta(minutes=int(length)), "%Y-%m-%d %H:%M:%S")
epoch_start_local = int(time.mktime(datetime.datetime.now().timetuple()))
epoch_start_utc = int(time.mktime(datetime.datetime.utcnow().timetuple()))
epoch_stop_local = int(time.mktime(datetime.datetime.timetuple(datetime.datetime.now() + datetime.timedelta(minutes=length))))
epoch_stop_utc = int(time.mktime(datetime.datetime.timetuple(datetime.datetime.utcnow() + datetime.timedelta(minutes=5))))
@ip2k
ip2k / index.js
Last active August 29, 2015 14:14
Hipchat plugin for the uptime project - https://github.com/fzaninotto/uptime
/**
* HipChat plugin for the uptime project - https://github.com/fzaninotto/uptime
*
* This index.js files goes to a directory `plugins/hipchat` in your installation of uptime.
*
* Notifies all events (up, down, paused, restarted) to HipChat
*
* This plugin has a dependency on `hipchatter`.
* Add this to the "dependencies" object in your `package.json` file :
*
@ip2k
ip2k / .bash_profile
Created January 27, 2015 21:03
pipe stdout of any command to a HipChat room
alias hcpipe='tee >(cat >&2 >&1)| curl --location -XPOST https://api.hipchat.com/v2/room/HIPCHAT-API-ROOM-NUMBER/notification?auth_token=YOUR-HIPCHAT-NOTIFY-AUTH-TOKEN-FOR-THAT-ROOM -H "Content-Type: text/plain" -d "/code $(cat 2>&1)"'
@ip2k
ip2k / gist:9cc5d879d41b79f0ec3a
Created February 3, 2015 02:34
javascript show show for n ms animation
window.fn.showFor = function (jqSelector, fadeOutTimeMs, fadeInTimeMs) {
// usage: rosetta.fn.showFor('#element-id', 5000) // shows #element-id for 5 seconds, then slow fades out
if (! fadeInTimeMs) { fadeInTimeMs = 1000; }
if (! fadeOutTimeMs) { fadeOutTimeMs = 5000; }
$(jqSelector).removeClass('hidden').fadeIn(parseInt(fadeInTimeMs));
setTimeout(function () {
$(jqSelector).fadeOut(1000, function () {
@ip2k
ip2k / .screenrc
Created February 11, 2015 22:22
.screenrc
startup_message off
activity "%c activity -> %n%f %t"
#caption always "%{= Wk}%-w%{= Bw}%n %t%{-}%+w %-="
#vbell off
term screen-256color
hardstatus on
hardstatus alwayslastline '%{= M} %H%{= G} %l %= %{= w}%-w%{+b r}%n*%t%{-b r}%{w}%+w %= %{c}%d %D %{B}%c '
escape ^\\
@ip2k
ip2k / gist:1244249
Created September 27, 2011 03:23
possible ruby bug
#!/usr/bin/env ruby
require 'yaml'
hashy = Hash["a" => 100, "b" => 200]
puts hashy.inspect
YAML::dump(hashy, File.open('test.yaml', 'w'))
puts YAML::load_file('test.yaml') # attempt 1
File.open( 'test.yaml' ) { |yf| puts YAML::load( yf ) } # attempt 2