Skip to content

Instantly share code, notes, and snippets.

View ochronus's full-sized avatar

Csaba Okrona ochronus

View GitHub Profile
@ochronus
ochronus / process-ring.rb
Created November 25, 2011 11:20
Simple process ring using ruby continuations
require "continuation" # ruby 1.9, 1.8 doesn't need this require
class Ring
def initalize
@next_node = nil
end
attr_accessor :next_node
def create_continuation
passesleft, message = callcc { |cont|
return cont
@ochronus
ochronus / gist:3799634
Created September 28, 2012 12:53
A régi CreatePFLookupValue függvény
function CreatePFLookupValue() {
global $akweb_connection;
$property_values = array();
$Query = "
CREATE TABLE IF NOT EXISTS `PFLookupValue` (
`ProductId` INT UNSIGNED NOT NULL,
`CategoryId` SMALLINT UNSIGNED NOT NULL,
`PropertyId` INT NOT NULL,
`PropertyValueId` INT UNSIGNED NOT NULL,
PRIMARY KEY (`ProductId`, `PropertyValueId`),
$ alias such=git
$ alias very=git
$ alias wow='git status'
$ wow
$ such commit
$ very push
@ochronus
ochronus / commands.sh
Last active November 21, 2023 11:28
CPU and disk benchmarks
# install sysbench
$ apt-get install sysbench
# CPU benchmark, 1 thread
$ sysbench --test=cpu --cpu-max-prime=20000 run
# CPU benchmark, 64 threads
$ sysbench --test=cpu --cpu-max-prime=20000 --num-threads=64 run
# Disk benchmark, random read. See .fio files in this gist

Keybase proof

I hereby claim:

  • I am ochronus on github.
  • I am ochronus (https://keybase.io/ochronus) on keybase.
  • I have a public key whose fingerprint is F2A9 DCD6 43E2 4C35 B14E A1AF 3C60 0433 84A5 7852

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am ochronus on github.
  • I am ochronus (https://keybase.io/ochronus) on keybase.
  • I have a public key whose fingerprint is F2A9 DCD6 43E2 4C35 B14E A1AF 3C60 0433 84A5 7852

To claim this, I am signing this object:

(ns noir01.views.welcome
(:require [noir01.views.common :as common]
[noir.content.getting-started])
(:use [noir.core :only [defpage]]))
(defpage "/welcome" []
(common/layout
[:p "Welcome to noir01"]))
#/bin/sh
MD5_TOOL=md5 # on linux set this to 'md5sum'
IFACE=en0 # probably eth0, etc on linux
RANDOM_MAC_ADDRESS=$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null|${MD5_TOOL}|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5:\6/')
sudo ifconfig ${IFACE} ether ${RANDOM_MAC_ADDRESS}
if [[ $? != 0 ]] ; then
echo "Error changing the MAC address of ${IFACE}"
exit 1
else
echo "The interface ${IFACE} has the MAC address: ${RANDOM_MAC_ADDRESS}"
# ----------------------------
# pgPool-II configuration file
# ----------------------------
#
# This file consists of lines of the form:
#
# name = value
#
# Whitespace may be used. Comments are introduced with "#" anywhere on a line.
# The complete list of parameter names and allowed values can be found in the
@ochronus
ochronus / js_native_check
Created August 18, 2014 06:56
Check if a JS function is native
function isNative(fn) {
return (/\{\s*\[native code\]\s*\}/).test('' + fn);
}