Skip to content

Instantly share code, notes, and snippets.

@jaysonrowe
jaysonrowe / FizzBuzz.js
Created January 11, 2012 01:39
FizzBuzz JavaScript solution
for (var i=1; i <= 20; i++)
{
if (i % 15 == 0)
console.log("FizzBuzz");
else if (i % 3 == 0)
console.log("Fizz");
else if (i % 5 == 0)
console.log("Buzz");
else
console.log(i);
@isa
isa / gist:1776881
Created February 9, 2012 02:58
Windows 2000 Source Code
/* Source Code Windows 2000 */
#include "win31.h"
#include "win95.h"
#include "win98.h"
#include "workst~1.h"
#include "evenmore.h"
#include "oldstuff.h"
#include "billrulz.h"
#include "monopoly.h"
@peternixey
peternixey / securing_rails_updates.md
Created March 5, 2012 13:10
How Homakov hacked GitHub and how to protect your application by Peter Nixey

##How Homakov hacked GitHub and the line of code that could have prevented it


Please note: THIS ARTICLE IS NOT WRITTEN BY THE GITHUB TEAM or in any way associated with them. It's simply hosted as a Gist because the markdown formatting is excellent and far clearer than anything I could manage on my personal Tumblr at peternixey.com.

If you'd like to follow me on twitter my handle is @peternixey


@ShirtlessKirk
ShirtlessKirk / luhn.js
Last active May 17, 2024 08:05
Luhn validation algorithm
/**
* Luhn algorithm in JavaScript: validate credit card number supplied as string of numbers
* @author ShirtlessKirk. Copyright (c) 2012.
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
var luhnChk = (function (arr) {
return function (ccNum) {
var
len = ccNum.length,
bit = 1,
@btoone
btoone / curl.md
Last active May 14, 2024 19:32
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@rbrooks
rbrooks / shape_bandwidth.sh
Created May 17, 2012 16:03
Bandwidth Shape (Throttle) a Network Interface
#!/bin/bash
#
# tc uses the following units when passed as a parameter.
# kbps: Kilobytes per second
# mbps: Megabytes per second
# kbit: Kilobits per second
# mbit: Megabits per second
# bps: Bytes per second
# Amounts of data can be specified in:
# kb or k: Kilobytes
@jbarham
jbarham / ipv6octal.py
Created May 29, 2012 23:40
Converts an IPv6 address to octal format for tinydns
# This function is a translation of the PHP function described at
# http://thisisnotajoke.com/2011/07/12/aaaa-for-tinydns-php-function/
def ipv6octal(ipv6):
while len(ipv6.split(':')) < 8:
ipv6 = ipv6.replace('::', ':::')
octets = []
for part in ipv6.split(':'):
if not part:
octets.extend([0, 0])
else:
@fogus
fogus / oops.dot
Created June 6, 2012 19:02
influence graph of oo languages -- this is not meant to be a complete time line. I'm mostly concerned with the root and inner nodes.
digraph G {
ranksep=1.0;
ratio=0.6;
LISP [color=Blue, shape=box, label="LISPs"];
ALGOL [color=Blue, shape=box, label="ALGOL-like\nLanguages"];
Modula [color=Blue, shape=box, label="Wirth's\nPascal-likes"];
Smalltalk [color=Blue, shape=box, label="Smalltalk-like\nLanguages"];
FP [color=Blue, shape=box, label="Functional\nProgramming\nLanguages"];
P [label="Prototype-based\nLanguages", color=Blue, shape=box];
@bamanzi
bamanzi / chroot.sh
Last active May 16, 2018 19:56
chroot wrapper
NEWROOT=`dirname $(readlink -f $0)`
read -n1 -p "chroot to $NEWROOT? (y/n) :" ack
[ foo"$ack" == fooy ] || exit -1
echo " "
function mount_if_not() {
dir=$1
mount | grep $NEWROOT$dir >/dev/null
@mark-cooper
mark-cooper / ia_batch.rb
Created June 21, 2012 15:52
Batch download books from Internet Archive using wget
# batch download books from Internet Archive using wget
# will not overwrite existing files with same filename
formats = [
'.pdf',
'.epub',
'.mobi',
]
id_file = 'id.txt' # file containing ids -- 1 per line i.e. daughtervine00atherich