Skip to content

Instantly share code, notes, and snippets.

/*
* def.js: Simple Ruby-style inheritance for JavaScript
*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(global) {
__super__ = function(){
var caller = __super__.caller;
#! /usr/bin/env ruby
status = DATA.flock(File::LOCK_EX | File::LOCK_NB)
if status == 0
puts "we have the lock..."
sleep
else
@blister
blister / gist:740829
Created December 14, 2010 18:19
Bash script to add a delay to the localhost interface on Linux machines
#!/bin/bash
# Copyright 2010 Eric Ryan Harrison <me@ericharrison.info>
# Inspired by:
# http://daniel.haxx.se/blog/2010/12/14/add-latency-to-localhost/
if [ -n "$1" ]
then
if [ "$1" = "off" ]
then
tc qdisc del dev lo root
@esperlu
esperlu / mysql2sqlite.sh
Created April 27, 2011 05:46
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@technoweenie
technoweenie / api_documentation.rb
Created April 29, 2011 11:54
discarded sinatra documentation extension
# Sinatra module for documenting an API. This info can be exported as JSON
# and used to generate other forms of documentation.
#
# Example documentation for a GET request:
#
# desc "List issues for this Repository"
# param :milestone, Fixnum
# param :state, String, :default => 'open', :choices => %w(open closed)
# get "/repos/:user/:repo/issues" do
# ...
#!/usr/bin/env ruby
#
# A quick script to dump an overview of all the open issues in all my github projects
#
require 'octokit'
require 'awesome_print'
require 'rainbow'
@tmpvar
tmpvar / LICENSE.txt
Created May 20, 2011 02:51 — forked from 140bytes/LICENSE.txt
hatch - the smallest hash based router you've ever seen
Copyright (c) 2011 Elijah Insua, http://tmpvar.com
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:
@futhr
futhr / TechDecisions.md
Last active October 4, 2015 12:58 — forked from hardbap/TechDecisions.md
Choices to make in a new Rails project.

Team Support

Source Code Control

Github
Alternative: Bitbucket, git (private server)

Time Tracking

None

#include <stdio.h>
int main(void) { /* required by this strange BASIC compiler... */
/* BASIC starts here... */
l10: printf("Hello World\n");
l20: goto l10;
} /* Again, without this it does not work. L4m3 people should not write BASIC compilers... */
/****************************************************************************
**
*F hash_dos.c Stuff 1.00 2012-06-06 ms
**
** This small program demonstrates that a multiplicative hash function
** CANNOT be secured against denial-of-service attacks using a initial seed
** value.
**
** That is because two strings <str1> and <str2> of the same length that
** hash to the same value (i.e. produce a collision) for ONE seed will