Skip to content

Instantly share code, notes, and snippets.

View jspc's full-sized avatar
🇰🇷 ✈️ 🇬🇧

jspc jspc

🇰🇷 ✈️ 🇬🇧
View GitHub Profile

Keybase proof

I hereby claim:

  • I am jspc on github.
  • I am jspc (https://keybase.io/jspc) on keybase.
  • I have a public key whose fingerprint is 5E44 BFDA 7D04 E5E5 9F59 3D56 E303 6728 70F9 5D79

To claim this, I am signing this object:

@jspc
jspc / irb.rb
Created July 6, 2015 16:33
99.95 + 99.95 percent
irb(main):072:0* counter = 0
=> 0
irb(main):073:0> iterations = 0
=> 0
irb(main):074:0> 1000000000000.times { iterations += 1 ; counter += 1 if Random.rand(2000) == Random.rand(2000) }
^CIRB::Abort: abort then interrupt!
from (irb):74:in `call'
from (irb):74:in `block in irb_binding'
from (irb):74:in `times'
from (irb):74
#!/usr/bin/env ruby
# Installation: 'gem install sinatra'
# Running: ruby hello_world.rb
# Using: The app will give you a port. Visit it.
require 'json'
require 'sinatra'
get '/' do
content_type :json
#!/usr/bin/env ruby
require 'mac_vendor'
mac_vendor = MacVendor.new
stations = {}
dns_leases = %x{systemctl status wifi}.split("\n").grep(/dnsmasq/).first.split.last
%x{iw dev ap0 station dump}.split("Station").each do |station|
@jspc
jspc / vid.sh
Created December 18, 2015 12:17
#!/usr/bin/env bash
# I have firefox pointing to socks on 9050; tor
COUNT=0
while true; do
((COUNT+=1))
echo "Opening url; iteration ${COUNT}"
firefox 'https://www.youtube.com/watch?v=vO4TXgUdf_c' &
PID=$!
#!/usr/bin/env bash
#
# Invoke as 'glitter.sh "glittery text"
BUILD_DIR=$(mktemp -d)
pushd $BUILD_DIR
convert -size 1024x100 xc: +noise Random -separate \
null: \( xc: +noise Random -separate -threshold 30% -negate \) \
-compose CopyOpacity -layers composite \
-set dispose background -set delay 20 -loop 0 glitter_overlay.gif
var main = function(m, x, y){
{
foo: bar,
baz: quux
}[m](x,y);
}
var bar = function(x,y){
// do something
}

Keybase proof

I hereby claim:

  • I am jspc on github.
  • I am jspc (https://keybase.io/jspc) on keybase.
  • I have a public key whose fingerprint is 601B 2884 821B 4798 3688 C3F7 9A58 E432 7E59 E36B

To claim this, I am signing this object:

uri = "threepio+", application, "://", path, "?", params;
application = "prelude" | "premiere";
path = "/", alphanumeric, {path};
params = param, {"&", params};
param = key, "=", value;
key = "accessKey" | "secretKey" | "sessionToken" | "uuid";
value = alphanumeric;
var uri = "http://domain.com:80/articles/something";
var regexp = /http:\/\/([^\/]+):[0-9]+\/articles\/[^\/]+/;
var matches = regexp.exec(uri);
console.log(matches);
//[ 'http://domain.com:80/articles/something',
// 'domain.com',
// index: 0,
// input: 'http://domain.com:80/articles/something' ]