Skip to content

Instantly share code, notes, and snippets.

View zeroeth's full-sized avatar
🤖
🐱 🤖 🐱 🤖

[0] zeroeth

🤖
🐱 🤖 🐱 🤖
View GitHub Profile
@zeroeth
zeroeth / wget_pull.sh
Created April 23, 2013 20:15
Download complicated web pages with json and javascript intact
wget --no-clobber --page-requisites --html-extension --convert-links http://thepage.com/thepage
# then view the page through a local webserver.
@zeroeth
zeroeth / build_polycode_osx.sh
Last active December 16, 2015 13:28
Polycode OSX 10.7 build with xcode 4.6.1
#!/bin/bash
# Performs full rebuild of Polycode dependencies and library, debug and release
# prereq:
# brew/port install Cmake
# sudo pip install ply
rm -rf Dependencies/Build
mkdir -p Dependencies/Build
@zeroeth
zeroeth / importbooks.rb
Last active December 15, 2015 13:29
importbooks.rb
response["books"].each do |book_hash|
Book.from_json(book_hash)
end
class Book < AR
def self.from_json(book_hash)
self.new({image: book_hash["i"], whatever else})
end
end
@zeroeth
zeroeth / README.md
Last active December 15, 2015 10:48 — forked from mbostock/.block

This example demonstrates loading of CSV data, which is then quantized into a diverging color scale. The values are visualized as colored cells per day. Days are arranged into columns by week, then grouped by month and years. Colors by Cynthia Brewer. Layout inspired by Rick Wicklin and Robert Allison.

Edited to play with a Google Calendar ICS, imported to Thunderbird/Lightning and exported to CSv.

@zeroeth
zeroeth / oauth_fix_initializer.rb
Created March 23, 2013 07:33
dirty fix for removing ports from rails redirects for Oauth
module OmniAuth
module Strategy
def full_host
uri = URI.parse(request.url)
uri.path = ''
uri.query = nil
uri.port = (uri.scheme == 'https' ? 443 : 80)
uri.to_s
end
end
@zeroeth
zeroeth / enigma7.java
Last active December 15, 2015 07:09
enigma fun
// rotors
int[][] NOTCHES = {
// Identity rotor:
{ 0 }, // A
// Standard rotors:
{ 17 }, // R
{ 5 }, // F
{ 22 }, // W
{ 10 }, // K
@zeroeth
zeroeth / cat
Created March 15, 2013 18:43
meow
/\ /\
{ `---' }
{ O O }
~~|~ V ~|~~
\ \|/ /
`-----'__
/ \ `^\_
{ }\ |\_\_ W
| \_/ |/ / \_\_( )
\__/ /(_E \__/
@zeroeth
zeroeth / duke.pl
Created March 13, 2013 01:40
irssi colors codes for scripting
sub cmd_color_weee {
foreach my $i (1..15) {
Irssi::active_win()->print(chr(3)."$i"."rubi ルビーオンレイルズ"." $i");
}
Irssi::active_win()->print("x %kr%ru%gb%yi %bル%mビ%wー%pオ%cン%nレ%kイ%rル%gズ");
Irssi::active_win()->print("X %Kr%Ru%Gb%Yi %Bル%Mビ%Wー%Pオ%Cン%Nレ%Kイ%Rル%Gズ");
Irssi::active_win()->print("# %0r%1u%2b%3i %4ル%5ビ%6ー%7オ%0ン%1レ%2イ%3ル%4ズ");
}
Irssi::command_bind('the_colors_duke', 'cmd_color_weee');
@zeroeth
zeroeth / database.yml
Last active December 14, 2015 19:49
per branch database.yml for rails
# add 'grit' and 'colored' to Gemfile
# you can delete the color methods on line #9 if you don't want to install colored gem.
# uses your typical app_development, app_test if git is under master.
# adds _branch_name to end if not.
<%
git_repo = Grit::Repo.new(".")
postfix = git_repo.head.name == 'master' ? nil : git_repo.head.name
app_name = Rails.application.class.parent_name.downcase
database = [app_name, Rails.env, postfix].compact.join("_")