Skip to content

Instantly share code, notes, and snippets.

@rogerhub
rogerhub / example.xml
Created February 9, 2014 01:35
An example import for Disqus.
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dsq="http://www.disqus.com/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:wp="http://wordpress.org/export/1.0/"
>
<channel>
<item>
<!-- title of article -->
var k = document.getElementsByClassName("resource_title");
for (var i = 0; i < k.length; i++) { console.log(k[i].href); }
@rogerhub
rogerhub / download.sh
Last active August 29, 2015 14:07
Download CS162 Section stuff
curl --location -o 162_Section_7.pdf https://piazza.com/class_profile/get_resource/hxmdrtyyder49a/i1d4b7jbdfx73n &
curl --location -o 162_Section_6.pdf https://piazza.com/class_profile/get_resource/hxmdrtyyder49a/i12m2sq8vai4sn &
curl --location -o 162_Section_5.pdf https://piazza.com/class_profile/get_resource/hxmdrtyyder49a/i1038u1ffau6ba &
curl --location -o 162_Section_4.pdf https://piazza.com/class_profile/get_resource/hxmdrtyyder49a/i0iskc99hkb6e2 &
curl --location -o 162_Section_3.pdf https://piazza.com/class_profile/get_resource/hxmdrtyyder49a/i08nmvwvdy97kv &
curl --location -o 162_Section_2.pdf https://piazza.com/class_profile/get_resource/hxmdrtyyder49a/hzz2riroivm22w &
curl --location -o 162_Section_1.pdf https://piazza.com/class_profile/get_resource/hxmdrtyyder49a/hzz2rc7db2f20m &
curl --location -o 162_Section_7_Solutions.pdf https://piazza.com/class_profile/get_resource/hxmdrtyyder49a/i1d4be9z5ps4pu &
curl --location -o 162_S
@rogerhub
rogerhub / formatter.patch
Created November 6, 2014 20:50
CPPCMS Patch for ICU format ambiguous definition
Index: booster/lib/locale/src/icu/formatter.cpp
===================================================================
--- booster/lib/locale/src/icu/formatter.cpp (revision 2283)
+++ booster/lib/locale/src/icu/formatter.cpp (working copy)
@@ -58,7 +58,7 @@
virtual string_type format(int64_t value,size_t &code_points) const
{
icu::UnicodeString tmp;
- icu_fmt_->format(value,tmp);
+ icu_fmt_->format(::int64_t(value),tmp);
@rogerhub
rogerhub / .tmux.conf
Created February 13, 2015 07:21
tmux config
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default
# set window split
bind-key | split-window -h
bind-key - split-window
set-option -g prefix C-a
@rogerhub
rogerhub / progressreport.py
Created March 11, 2015 01:15
Simple progress report for batch jobs Python.
import time
import threading
import sys
class ProgressReport(object):
interval = 0.2
def __init__(self, name, fn):
self.job_name = name
@rogerhub
rogerhub / .tmux.conf
Created May 20, 2015 05:05
Dot files
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default
# set window split
bind-key | split-window -h
bind-key - split-window
set-option -g prefix C-a
@rogerhub
rogerhub / fish_right_prompt
Created August 11, 2015 07:41
OS X Terminal.app and Fish shell intergration
function fish_right_prompt
printf "\033]7;file://localhost%s\a" (echo "$PWD" | sed -e 's/ /%20/g')
end
@rogerhub
rogerhub / password_gen.rb
Created September 27, 2011 01:58
Password generator for Clark w/ default salt built in
require 'digest/sha2'
adjectives = %w[red orange blue green purple big small wide thin gray long dark high low white smooth cool hot dusty sticky furry nice mean rich poor yellow sad happy ]
nouns = %w[book ruler kleenex glasses wand scissors stapler eraser drive car truck road basketball skateboard statue box square circle tree grass flower plant rose ]
500.times do
password = adjectives[rand(adjectives.size)] + nouns[rand(nouns.size)] + rand(10).to_s
puts password + "\t" + Digest::SHA512.hexdigest(password + "thisGETSridOFrainbowTABLES")
end
@rogerhub
rogerhub / fuse-zip-homebrew.md
Created October 8, 2015 02:29
fuse-zip fails to install via homebrew on OS X 10.11 with boxen (or non-standard homebrew path)

The gist of the problem is that brew install fuse-zip shows me something like this on OS X 10.11:

ar -cr libfusezip.a bigBuffer.o extraField.o fileNode.o fuse-zip.o fuseZipData.o
clang++ main.o -Xlinker -L/usr/local/libinstall -Llib -lfusezip -L/usr/local/lib -losxfuse -pthread -liconv  -L/opt/boxen/homebrew/Cellar/libzip/1.0.1/lib -lzip -lz  \
	    -v -o fuse-zip
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.11.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -w -o fuse-zip -Llib -L/opt/boxen/homebrew/Cellar/libzip/1.0.1/lib -L/opt/boxen/homebrew/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries main.o -L/usr/local