Skip to content

Instantly share code, notes, and snippets.

View kucerarichard's full-sized avatar

Richard kucerarichard

View GitHub Profile
@brentonashworth
brentonashworth / clj.rb
Created December 3, 2009 04:59
Ruby Script to run Clojure
#!/usr/bin/env ruby -wKU
JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home"
JAVA="#{JAVA_HOME}/bin/java"
GIT_ROOT=ENV['GIT_ROOT']
CLJ="/opt/clojure"
LIB="#{GIT_ROOT}/library"
classpath=".:src:test:classes" +
":#{GIT_ROOT}/formpluslogic/fpl-clojure-util/fpl-clojure-util.jar" +
":#{CLJ}/swank-clojure/src/"
@sirupsen
sirupsen / tdo.rb
Created December 13, 2009 01:46
Gist for "What I Wish a Ruby Programmer Had Told Me One Year Ago".
class TodoList < Array
def self.load(file)
# read the file, create a list, create items, add them to the list, return the list
list = TodoList.new
File.read(file).each_line do |line|
list << line.chomp
end
list
end
@wittman
wittman / stackoverflowIndentFourSpaces.php
Created January 6, 2010 23:16
stackoverflowIndentFourSpaces - Indent Four Spaces (for stackoverflow.com)
<?php
/*
Copyright (C) 2010 Micah Wittman | http://wittman.org/ | stackoverflow.m[a][t]wittman.org | http://stackoverflow.com/users/11181/micahwittman | http://twitter.com/micahwittman
Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL (http://www.gnu.org/licenses/) licenses.
Hosted application:
http://wittman.org/projects/stackoverflowindentfourspaces/
Repositories:
http://wittman.org/projects/stackoverflowindentfourspaces/stackoverflowIndentFourSpaces.php
var sys = require('sys'),
rest = require('restler-aaronblohowiak'),
item,
node
rest.get('http://mikecantelon.com/jsontest/News')
.addListener('complete', function(data) {
for(item in data.nodes) {
node = data.nodes[item].node
@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
@krams915
krams915 / haproxy.cfg
Created October 7, 2011 00:20
haproxy.cfg - Notes
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#Adds a global syslog server. Up to two global servers can be defined. They
#will receive logs for startups and exits, as well as all logs from proxies
#configured with "log global". An optional level can be specified to filter
#outgoing messages. By default, all messages are sent.
#An IPv4 address optionally followed by a colon and a UDP port. If
#no port is specified, 514 is used by default (the standard syslog port).
@jsmorph
jsmorph / logicrels-lucene.clj
Created July 6, 2012 14:01
Lucenalog: Datalog interface to Lucene in 10 lines
(ns lucenalog.core
"Lucenalog = Datalog interface to Lucene in 10 lines.
Simple but powerful.
Use
(db/add (index) {:a \"foo\" :b \"bar\"})
to index a map with Lucene. Then you can use the relation
@kgriffs
kgriffs / sysctl.conf
Last active September 17, 2024 16:34
Linux Web Server Kernel Tuning
# Configuration file for runtime kernel parameters.
# See sysctl.conf(5) for more information.
# See also http://www.nateware.com/linux-network-tuning-for-2013.html for
# an explanation about some of these parameters, and instructions for
# a few other tweaks outside this file.
#
# See also: https://gist.github.com/kgriffs/4027835
#
# Assumes a beefy machine with lots of network bandwidth
@rossant
rossant / raytracing.py
Last active June 25, 2024 20:58
Very simple ray tracing engine in (almost) pure Python. Depends on NumPy and Matplotlib. Diffuse and specular lighting, simple shadows, reflections, no refraction. Purely sequential algorithm, slow execution.
"""
MIT License
Copyright (c) 2017 Cyrille Rossant
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
@bosky101
bosky101 / stress-docker-run
Last active December 25, 2015 21:19
stress testing the creation of a 1000 docker containers, comes across file descriptor and iptable errors
[] ubuntu@~$ sudo docker version
Client version: 0.6.3
Go version (client): go1.1.2
Git commit (client): b0a49a3
Server version: 0.6.3
Git commit (server): b0a49a3
Go version (server): go1.1.2
Last stable version: 0.6.4, please update docker
[] ubuntu@~$ ulimit -a