Skip to content

Instantly share code, notes, and snippets.

@speric
speric / shortlog.md
Last active August 29, 2015 14:03
Short Log
# alias clean-branches="git branch --merged master | grep -v \"\* master\" | xargs -n 1 git branch -d"
$ git co master
$ git pull
$ clean-branches
$ git shortlog $VERSION..HEAD
@speric
speric / keybase.md
Created August 8, 2014 18:09
keybase.md

Keybase proof

I hereby claim:

  • I am speric on github.
  • I am speric (https://keybase.io/speric) on keybase.
  • I have a public key whose fingerprint is 17C2 5F10 32BF FAF5 AF67 880A FFB0 589B 47F6 E4BC

To claim this, I am signing this object:

@speric
speric / gifts.md
Last active August 29, 2015 14:08
Gift Ideas For Young Engineers
  • Leatherman for young'ins ($54) Comes with the knife blade detached which can be added when 'earned:' http://gearjunkie.com/leatherman-leap-kids-multi-tool
  • Weather Lab ($15) This is more science oriented. Science can be boring at times, but carefully noting numbers and charting phenomenon to find correlation is a concept all should understand. www.smartlabtoys.com/you-track-it-weather-lab.html
  • Robo Link A ($25) Kit that builds five robot variations. It's not an intelligent (interactive) robot. It's mean to learn bout gears (mechanical engineering). www.makershed.com/products/robo-link-a
  • Lego Mindstorms EV3 ($350) shop.lego.com/en-US/LEGO-MINDSTORMS-EV3-31313 Ultimate lego kit, comes with motors, sensors and programmable controller which allows you to write programs and built ultimately anything (robots, machines, etc.). You can use their graphical programming language or venture out into RobotC, which is C-based. Make serious robots without electronics to get in the way.
  • **Flexbot
@speric
speric / trackback.php
Last active August 29, 2015 14:11
Ping WordPress trackback URLs
<html>
<head>
<title>SD News Pinger</title>
<style>
body{ font-family: Arial, sans-serif; font-size: 12px; }
</style>
</head>
<body>
<?php
date_default_timezone_set('America/New_York');
@speric
speric / x.md
Last active August 29, 2015 14:15
Time.zone.parse differences depending on mm dd yyyy separator character
# Rails 3.2.21, ruby 2.0.0p353

# 'American' style
> Time.zone.parse("11/12/2012 10:10")
=> Mon, 12 Nov 2012 10:10:00 EST -05:00

# 'Rest of the world' style
> Time.zone.parse("11-12-2012 10:10")
=&gt; Tue, 11 Dec 2012 10:10:00 EST -05:00
@speric
speric / x.md
Last active August 29, 2015 14:17
Summon the Ender Dragon, and ride it with a minecart

/summon Minecart ~ ~1 ~ {Riding:{id:EnderDragon}}

@speric
speric / sendgrid.py
Created April 26, 2012 16:29
Grab bounced emails from Sendgrid
import tornado.options
import urllib2
import json
from tornado.options import define, options
if __name__ == "__main__":
define("username", help="Your Sendgrid username (usually an email address)")
define("password", help="Your Sendgrid password")
@speric
speric / resize.js
Created May 14, 2012 12:10
Resize w/jQuery
<script src="/javascripts/jquery.resize.js"></script>
<script>
$('.agency_talent_photo').resize(150);
</script>
@speric
speric / multisite.rb
Created November 20, 2012 19:54
Multisite Shop Example w/MongoDB
# Order class
# see http://www.slideshare.net/wonko/persisting-dynamic-data-with-mongodb-and-mongomapper
class Order
include MongoMapper::Document
key :order_id, String
class << self
def for_site(site)
klass = Class.new(self)

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs