Skip to content

Instantly share code, notes, and snippets.

#Pausing all but x CPU-intensive tasks
PAUSEQUEUENUM=0
ACTIVEQUEUENUM=0
function putinpausequeue {
kill -STOP $1
PAUSEQUEUE="$PAUSEQUEUE $1"
PAUSEQUEUENUM=$(($PAUSEQUEUENUM+1))
echo "Notice. I am pausing $1 . The pause queue is now $PAUSEQUEUE"
/***************************************************************************
* Copyright (C) 2009 by Paul Lutus, Ian Clarke *
* lutusp@arachnoid.com, ian.clarke@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
require 'rubygems'
require 'spoon'
Spoon.spawnp 'jruby', *ARGV
@cbrumelle
cbrumelle / kd-tree.rb
Created March 10, 2010 21:23
KD-TREE's in ruby
require 'pp'
class KDTree
attr_reader :root
attr_reader :points
def initialize(points, dim)
@dim = dim
@root = KDNode.new(dim).parse(points)
end
votes CF
"back in black" => { 201005211200 => '1', 201005201159 => '1', 201005201157 => '1', 201005011900 => '1', 201004190600 => '1' },
"black album" => { 201005021800 => '1', 201005010600 => '1' },
"black star" => { 201005011000 => '1' }
cached_counts CF
"back in black" => { 'cached_count' => 2, 'counted_until' => 201005011931 },
"black album" => { 'cached_count' => 1, 'counted_until' => 201005010600 }
@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
@koshigoe
koshigoe / mount-ram.sh
Created February 11, 2011 14:57
Like tmpfs in Mac OSX
#!/bin/sh
# This program has two feature.
#
# 1. Create a disk image on RAM.
# 2. Mount that disk image.
#
# Usage:
# $0 <dir> <size>
#
@takumakei
takumakei / JSONEntity.java
Created April 11, 2011 04:53
An utility class to POST json(optionally gzipped) with Apache HttpClient.
/* JSONEntity.java
* An utility class to POST json(optionally gzipped) with Apache HttpClient.
*
* Copyright (C) 2011 TAKUMAKei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@jippi
jippi / rc.d
Created July 5, 2011 19:58 — forked from vvuksan/gist:988765
Logstash Init script
update-rc.d logstash-shipper defaults
update-rc.d logstash-reader defaults
@rednaxelafx
rednaxelafx / JDK5u22_client.log
Created August 23, 2011 16:43
PrintCompilation samples running Groovy shell 1.7.7 on different versions of HotSpot VM
1 b java.lang.String::charAt (33 bytes)
2 b java.lang.Math::max (11 bytes)
3 b java.util.jar.Manifest$FastInputStream::readLine (167 bytes)
4 b sun.nio.cs.UTF_8$Decoder::decodeArrayLoop (553 bytes)
5 b java.util.Properties$LineReader::readLine (383 bytes)
6 b java.lang.String::hashCode (60 bytes)
7 b java.lang.String::indexOf (151 bytes)
8 b sun.nio.cs.ext.DoubleByteDecoder::decodeSingle (10 bytes)
9 b java.lang.String::lastIndexOf (156 bytes)
10 b java.lang.String::replace (142 bytes)