This file contains 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 'pry' | |
class Binding | |
def pray(expected_condition) | |
unless eval(expected_condition) | |
puts 'prayers unanswered, mortal' | |
pry | |
end | |
end | |
end |
This file contains 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 ValueCache | |
@@last_set = 0 | |
@@last_val = nil | |
def get_val | |
# do not re-process more than once every 10s | |
if Time.now.to_i - 10 > @@last_set | |
@@last_val = [1,2,3,4,5,6].sample | |
@@last_set = Time.now.to_i | |
end |
This file contains 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 parse_params(uri) | |
CGI.unescape(uri.split("?").last).split('&').each_with_object({}) do |p,c| | |
key, val = p.split('=') | |
c[key] = val | |
end | |
end |
This file contains 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 'rubygems' | |
data = Gem::Specification.map do |gemspec| | |
{ | |
name: gemspec.name, | |
version: "'#{gemspec.version.to_s}'", | |
license: gemspec.license, | |
homepage: gemspec.homepage, | |
source: "Gem::Specification.each" | |
} |
This file contains 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
puts (0..255).map{|x|x.to_s(16).rjust(2,'0')}.sample(6).join(':') |
This file contains 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 'ipaddr' | |
require 'pry' | |
subt = '10.0.0.0/8' | |
sub_size = IPAddr.new(subt).to_range.count | |
t = Time.now.to_f | |
IPAddr.new(subt).to_range.include?('10.1.1.1') | |
t2 = Time.now.to_f |
This file contains 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
import Numeric | |
from gnuradio import gr, gru | |
import crc16 | |
import gnuradio.gr.gr_threading as _threading | |
import struct | |
import cogra |
This file contains 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
import Numeric | |
from gnuradio import gr, gru | |
import crc16 | |
import gnuradio.gr.gr_threading as _threading | |
import struct | |
import cogra |
This file contains 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
#! /usr/bin/env python | |
from PIL import Image, ImageDraw, ImageFont | |
import os, sys, gzip, math, argparse, colorsys, datetime | |
from collections import defaultdict | |
from itertools import * | |
urlretrieve = lambda a, b: None | |
try: | |
import urllib.request |
This file contains 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
outputfile=somecrap.out | |
echo 'enter your name fool' | |
read name | |
cat << _EOF_ > $outputfile | |
this is my file | |
blah blah blah | |
your name is $name |