Skip to content

Instantly share code, notes, and snippets.

View rares's full-sized avatar
🌑

(╯°□°)╯︵ ┻━┻ rares

🌑
View GitHub Profile
@davist11
davist11 / gist:1204569
Last active January 19, 2024 15:03
Campfire sounds
56k: "https://123.campfirenow.com/images/56k.gif"
bell: ":bell:"
bezos: ":laughing::thought_balloon:"
bueller: "anyone?"
butts: ":open_hands: :smoking:"
clowntown: "https://123.campfirenow.com/images/clowntown.gif"
cottoneyejoe: ":notes::hear_no_evil::notes:"
crickets: "hears crickets chirping"
dadgummit: "dad gummit!! :fishing_pole_and_fish:"
dangerzone: "https://123.campfirenow.com/images/dangerzone.png"
@funny-falcon
funny-falcon / patch-1.9.2-gc.patch
Created March 5, 2011 11:11
GC tunning simple patch ruby 1.9.2 p180
diff --git a/gc.c b/gc.c
--- a/gc.c
+++ b/gc.c
@@ -77,6 +77,41 @@ void *alloca ();
#ifndef GC_MALLOC_LIMIT
#define GC_MALLOC_LIMIT 8000000
#endif
+#define HEAP_MIN_SLOTS 10000
+#define FREE_MIN 4096
+
package com.banksimple.util
private[util] final class Effectful[T](val origin: T) {
/**
* A special case of doto, andAlso is useful for
* quick logging or output tasks. Similar in use
* to doto, but only takes one function.
* */
def andAlso(x: T => Unit): T = { x(origin) ; origin }
;; Packaged version of singly-linked list based FIFO queue described
;; by Paul Graham in Ansi Common Lisp. Functions names changed not to
;; conflict with the lock free queue in sb-concurrency.
;; Taken from
;; http://cs.northwestern.edu/academics/courses/325/programs/graham.lisp
(defpackage :pg-queue (:use :cl))
(in-package :pg-queue)
@mojombo
mojombo / vwilight.vim
Created January 26, 2011 03:23
vwilight.vim: A TRUE Twilight color theme for Vim
" Vim color file
" Converted from Textmate theme Twilight using Coloration v0.2.5 (http://github.com/sickill/coloration)
set background=dark
highlight clear
if exists("syntax_on")
syntax reset
endif
@mccv
mccv / Send.scala
Created December 22, 2010 07:19
Hobo Ruby send equivalent. Really just syntactic sugar for standard reflection stuff
import java.lang.reflect.Method
class Sendable(a: AnyRef) {
val methods = a.getClass.getDeclaredMethods
def wrapByte(b: Byte) = new java.lang.Byte(b)
def wrapShort(s: Short) = new java.lang.Short(s)
def wrapInt(i: Int) = new java.lang.Integer(i)
def wrapLong(l: Long) = new java.lang.Long(l)
def wrapFloat(f: Float) = new java.lang.Float(f)
@blt04
blt04 / mongoid_serialization.rb
Created December 16, 2010 18:52
Mongoid::Document XML and JSON serialization customizations
#
# This core extension customizes XML and JSON serialization in Mongoid::Document
# objects:
# * Serializes BSON::ObjectIDs as strings in XML
# * Removes leading underscores from attributes (such as _id, _type)
# * Allows documents to customize serialization even further by declaring a
# `serialize_attributes!` method, e.g.:
# def serialize_attributes!(attribute_hash)
# attribute_hash.delete(:unnecessary_key)
# attribute_hash[:password] = ''
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <hiredis/libevent.h>
void getCallback(redisContext *c, redisReply *reply, const void *privdata) {
printf("argv[%s]: %s\n", (const char*)privdata, reply->reply);
/* Disconnect after receiving the reply to GET */
redisDisconnect(c);
class Proc
def <<(other)
case other
when Proc
Proc.new do |*args|
call(other.call(*args))
end
else
call(other)
end
@defunkt
defunkt / murder.sh
Created July 22, 2010 19:20
murder processes matching a pattern
# sh function to murder all running processes matching a pattern
# thanks 3n: http://twitter.com/3n/status/19113206105
murder () {
ps | grep $1 | grep -v grep | awk '{print $1}' | xargs kill -9
}