This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [$(ipfw show | grep 'pipe 1' | wc -l) -lt 1 ]; | |
| then | |
| echo "Slowing down network, bro" | |
| ipfw add pipe 1 all from any to any | |
| ipfw pipe 1 config bw 300Kbit/s delay 400ms | |
| else | |
| echo "Speeding things up again, boss" | |
| ipfw show | grep 'pipe 1' | awk '{print $1;}' | awk '{gsub(/^0+/, "")}; 1' | xargs ipfw delete | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Symbol | |
| def ~@ | |
| _bound = binding | |
| return ->(arg) {_bound.send(self, arg)} | |
| end | |
| end | |
| %w{lib1 lib2 lib3}.map &~:require |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'gosu' | |
| class FrameKeeper | |
| attr_reader :this, :last, :delta | |
| def initialize | |
| @last = Gosu::milliseconds | |
| end | |
| def update | |
| @this = Gosu::milliseconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_raw_json_from(url) | |
| Net::HTTP.get(URI.parse(url)) | |
| end | |
| def get_json_from(url) | |
| Hashie::Mash.new(JSON.parse(get_raw_json_from(url))) | |
| end | |
| def get_board(board, page) | |
| get_json_from "http://api.4chan.org/#{board}/#{page}.json" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module PL | |
| module Pragma | |
| module Poker | |
| # testing a theory, don't mind me | |
| def self.new_deck | |
| cards = "chsd".split(//).collect {|x| ['A','2','3','4','5','6','7','8','9','10','J','Q','K'].collect {|y| y + x}}.flatten | |
| 13.times { cards.each_index {|x| y = rand(cards.length - 1); cards[x], cards[y] = cards[y], cards[x]}} | |
| cards | |
| end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| =begin | |
| PassageParser, should match books of the bible | |
| This looked like a good page for abbreviations: | |
| # http://www.logos.com/support/windows/L3/book_abbreviations | |
| Also, should be able to match the following formats: | |
| Book ch | |
| Book c1-c2 | |
| Book ch:vs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| =begin | |
| dex.rb: Dex Recursive Data Structure | |
| Functionality: | |
| 1. dx = Dex.new( hash of values OR a list of arguments to schematize- see #3) | |
| 2. dx.a.b.c = 5 | |
| [creates Dex children b and b.c and sets b.c to 5] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git_prompt () { | |
| if ! git rev-parse --git-dir > /dev/null 2>&1; then | |
| return 0 | |
| fi | |
| git_branch=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p') | |
| echo "[$git_branch]" | |
| } | |
| PS1="\w \$(git_prompt)\$ " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| +javascript:(function()%7Bd%3Ddocument%3Bs%3Dd.createElement(%22script%22)%3Bs.src%3D%22//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js%22%3Bs.type%3D%22text/javascript%22%3Bd.getElementsByTagName(%22head%22)%5B0%5D.appendChild(s)%3B%24().ready(function()%7B%24(%22.spoiler%22).click(function()%7B%24(this).removeClass(%22spoiler%22)%7D)%7D)%7D)()%3B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Hash | |
| def search(m) | |
| retval = [] | |
| self.each_pair do |k,v| | |
| if v.kind_of?(Hash) | |
| v.search(m).each {|u| retval << [k,*u]} | |
| else | |
| rets = case m | |
| when Regexp | |
| v.to_s =~ m |
OlderNewer