Skip to content

Instantly share code, notes, and snippets.

@peterc
peterc / domainavailable
Created February 13, 2009 13:30
Check if a domain is available to register (uses DNS before WHOIS to be fast) - supports .com,.net,.org,.co.uk - inspired by foca/giles http://gilesbowkett.blogspot.com/2009/02/simple-bash-domain-availability.html
#!/bin/bash
# domainavailable
# Fast, domain name checker to use from the shell
# Use globs for real fun:
# domainavailable blah{1..3}.{com,net,org,co.uk}
# Inspired by foca / giles:
# http://gilesbowkett.blogspot.com/2009/02/simple-bash-domain-availability.html
trap 'exit 1' INT TERM EXIT
@Chrisso
Chrisso / Logging.h
Created November 8, 2011 15:18
C++ Logging using ATL (subset of MFC)
/*
Copyright (c) 2011 Christoph Stoepel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@jboner
jboner / latency.txt
Last active June 22, 2024 06:13
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
require 'sinatra'
require 'net/ldap'
ldap = Net::LDAP.new
ldap.host = '192.168.1.1'
ldap.port = 389
ldap.auth "username", "password"
treebase = "dc=reputablecompany, dc=com"
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@jvns
jvns / interview-questions.md
Last active May 14, 2024 18:47
A list of questions you could ask while interviewing

A lot of these are outright stolen from Edward O'Campo-Gooding's list of questions. I really like his list.

I'm having some trouble paring this down to a manageable list of questions -- I realistically want to know all of these things before starting to work at a company, but it's a lot to ask all at once. My current game plan is to pick 6 before an interview and ask those.

I'd love comments and suggestions about any of these.

I've found questions like "do you have smart people? Can I learn a lot at your company?" to be basically totally useless -- everybody will say "yeah, definitely!" and it's hard to learn anything from them. So I'm trying to make all of these questions pretty concrete -- if a team doesn't have an issue tracker, they don't have an issue tracker.

I'm also mostly not asking about principles, but the way things are -- not "do you think code review is important?", but "Does all code get reviewed?".

@jamesbarnett
jamesbarnett / gist:9106565
Created February 20, 2014 03:23
First stab at a Makefile for building libcinder apps on Mavericks
CC=g++
CFLAGS=-g -Wall -std=c++11 -I/usr/local/include -I/Users/jbarnett/cinder/include
LIBPATH += -L"/System/Library/Frameworks/CoreLocation.framework/Resources"
LIBPATH += -L"/System/Library/Frameworks/Accelerate.framework/Resources"
LIBPATH += -L"/System/Library/Frameworks/ApplicationServices.framework/Resources"
LIBPATH += -L"/System/Library/Frameworks/QuickTime.framework/Resources"
LIBPATH += -L"/System/Library/Frameworks/Carbon.framework/Resources"
LIBPATH += -L"/System/Library/Frameworks/Cocoa.framework/Resources"
LIBPATH += -L"/System/Library/Frameworks/OpenGL.framework/Libraries"
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active June 12, 2024 03:08
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@mutolisp
mutolisp / mdb2postgres.sh
Created November 12, 2014 09:24
Convert Microsoft Access *.mdb file into PostgreSQL database
#!/usr/bin/env bash
# install mdbtools first!
# mdbtools: https://github.com/brianb/mdbtools
# ref: https://wiki.postgresql.org/wiki/Converting_from_other_Databases_to_PostgreSQL
DBMS=postgres
for MDB in `ls | grep .mdb$`
@eatonphil
eatonphil / server.ml
Last active April 20, 2024 10:42
A simple threaded web server in SML
(*
* Tested on PolyML. `polyc server.ml && ./a.out`
*)
fun println s =
(print (s ^ "\n"); TextIO.flushOut TextIO.stdOut)
fun readAll conn req =
let val ntoread = Socket.Ctl.getNREAD conn in
if ntoread > 0