Skip to content

Instantly share code, notes, and snippets.

View jleedev's full-sized avatar
🧙‍♀️

Josh Lee jleedev

🧙‍♀️
View GitHub Profile
@jleedev
jleedev / block.json
Created April 26, 2014 17:48
wow i blocked a lot of twitter users
["23andMe", "4TucsonTeachers", "5gum", "AAACincy", "AARP", "AEA", "AETV", "AMCTheatres", "ANGAus", "AOL", "ATT", "ATTDeals", "AXE", "Accellion", "Accenture", "According2Casey", "ActivateN", "ActiveState", "ActoniaInc", "Acura_Insider", "AdExchangerJobs", "Adconion_Direct", "AdobeEdu", "AdrianPeterson", "AgentsofSHIELD", "AkkenCloud", "AmericanExpress", "AnDevCon", "AndreeHewitt", "AosthirMahmood", "Apperian", "Apptio", "AroundTownHVAC", "Art_Of_Climbing", "ArubaNetworks", "Audi", "AudrinaPatridge", "AuraSuites1", "BACARDI", "BMWi", "BPTeamUSA", "BancoMundial", "Banfield", "BarclaysFooty", "Bazaarvoice", "BehrPro", "BerkeleyData", "BestBuy", "BestBuy_Deals", "BetrayalABC", "BeyondTrust", "Bit9", "BiteSize_x", "Bitly", "BlackBerry", "Blackboard", "BlurbBooks", "BofA_Community", "BoxHQ", "Bravotv", "BrightHorizons", "BrittiAnn", "Broadcom", "BrotherOffice", "BuySellAds", "CAinc", "CBSSportsNet", "CDWCorp", "CNN", "CSIdentity", "CWAUnion", "CXthecloud", "CareerFuel", "Carestream", "Carhartt", "Carrabbas", "Caspio
~$ python3 -m timeit -s 'add=lambda x,y:x+y' $'x=0\nfor i in range(1000000):x=add(x,1)\nassert x==1000000'
10 loops, best of 3: 189 msec per loop
~$ pypy3 -m timeit -s 'add=lambda x,y:x+y' $'x=0\nfor i in range(1000000):x=add(x,1)\nassert x==1000000'
100 loops, best of 3: 2.2 msec per loop
~$ python3 -m timeit -s 'from ctypes import c_long;add=lambda x,y:c_long(c_long(x).value+c_long(y).value).value' $'x=0\nfor i in range(1000000):x=add(x,1)\nassert x==1000000'
10 loops, best of 3: 1.07 sec per loop
~$ pypy3 -m timeit -s 'from ctypes import c_long;add=lambda x,y:c_long(c_long(x).value+c_long(y).value).value' $'x=0\nfor i in range(1000000):x=add(x,1)\nassert x==1000000'
10 loops, best of 3: 530 msec per loop
~$ python3 -m timeit -s 'from ctypes import c_long' $'x=c_long(0)\nfor i in range(1000000):x.value+=1\nassert x.value==1000000'
10 loops, best of 3: 217 msec per loop
~$ TZ=Pacific/Apia date -d @1325239199
Thu Dec 29 23:59:59 SDT 2011
~$ TZ=Pacific/Apia date -d @1325239200
Sat Dec 31 00:00:00 WSDT 2011
@jleedev
jleedev / designer.html
Last active August 29, 2015 14:13
designer
<link rel="import" href="../speech-mic/speech-mic.html">
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
use std::net::{TcpListener, TcpStream};
use std::thread;
use std::io::{stderr,Write,Read};
use std::env::args;
macro_rules! unwrap_fmt {
($expr:expr) => (match $expr {
Ok(val) => val,
Err(err) => panic!("{}", err)
})
git init --bare dotfiles.git
cd dotfiles.git/
git config:
core.worktree=/home/josh/
status.showuntrackedfiles=no
@jleedev
jleedev / wallrotate.rb
Created February 9, 2010 08:39 — forked from tensorpudding/wallrotate.rb
Wallpaper rotation script
#!/usr/bin/env ruby
srand
command = ["/usr/bin/feh","--bg-scale"]
dir = ARGV[0] || "/home/michael/wall/default/"
choice = Dir[dir + "*.{jpg,png,jpeg}"].choice
system *([command] + [choice]) unless choice.empty?
@jleedev
jleedev / razr.rb
Created February 26, 2010 17:50
Timestamps RAZR pictures
#!/usr/bin/env ruby
Dir["*.jpg"].each do |file|
mm,dd,yy,h,m = [0,3,6,9,11].map { |start| file[start,2] }
stamp = "20%s-%s-%s %s:%s" % [yy,mm,dd,h,m]
`exiv2 -k -Y 20#{yy} -O #{mm} -D #{dd} -a#{h}:#{m} ad "#{file}"`
exit $?.exitstatus if $?.exitstatus.nonzero?
`touch -d "#{stamp}" "#{file}"`
exit $?.exitstatus if $?.exitstatus.nonzero?
end
@jleedev
jleedev / sansa-clip.py
Created July 16, 2010 21:28
Put track numbers in a format that the Sansa Clip doesn't choke on.
# Put track numbers in a format that the Sansa Clip doesn't choke on.
from mutagen.easyid3 import EasyID3
import sys,re
r = re.compile('\d/\d\d')
for f in sys.argv[1:]:
print f
g = EasyID3(f)
@jleedev
jleedev / gist:497243
Created July 29, 2010 04:29
Screwing with subprocess
from signal import *
from subprocess import *
Popen(['true']).communicate()
signal(SIGCHLD, SIG_IGN)
Popen(['true']).communicate()