Skip to content

Instantly share code, notes, and snippets.

sysctl -w vm.min_free_kbytes=16000
sysctl -w vm.overcommit_memory=2
sysctl -w vm.overcommit_ratio=100
sysctl -w vm.panic_on_oom=1
sysctl -w kernel.panic_on_oops=1
sysctl -w kernel.panic=10
Setting the "X-EventQL-Namespace" header will specify the database for which the operation should
be executed.
For example if you want to use the database "test", set this header:
curl ... -H "X-EventQL-Namespace: test"
@asmuth
asmuth / CMakeLists.txt
Created December 22, 2014 11:58
most simple CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(blahblah)
set(PROJ_SOURCES
src/a.cc
src/b.cc)
if(APPLE)
set(CMAKE_CXX_FLAGS "-std=c++0x -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
else()
@asmuth
asmuth / statsd_bridge.rb
Created November 10, 2014 14:59
statsd fork/bridge (forward statsd data to multiple hosts)
#!/usr/bin/env ruby
require "socket"
udp = UDPSocket.new
udp.bind('0.0.0.0', 8125)
targets = [
["localhost", 8125],
["other.host.net", 8125]
]
/*
* This file is part of the "plgl" project
* (c) 2014 Paul Asmuth <paul@paulasmuth.com>
*
* All rights reserved. Please contact me to obtain a license.
*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <plgl/engine.h>
@asmuth
asmuth / fnord.asm
Last active February 6, 2017 03:22
print (hexa-)decimal numbers in pure x86 assembler (using the OSX/mach system call convention)
; compile & run on OSX
; $ nasm -f macho -o /tmp/fnord.o fnord.asm
; $ ld -o /tmp/fnord /tmp/fnord.o
; $ /tmp/fnord
section .data
section .text
global start
start:
@asmuth
asmuth / loveos_render.c
Last active December 16, 2015 17:19
product listview rendering in c (WIP)
// This file is part of the "LoveOS" project
// (c) 2013 DaWanda GmbH, Paul Asmuth <paul@paulasmuth.com>, et al.
// All rights reserved.
#include "plv.h"
#include "ruby.h"
VALUE loveos_render = Qnil;
// glue code to call the plv_load_json + plv_render methods from ruby
// FnordMetric Enterprise
// (c) 2011-2013 Paul Asmuth <paul@paulasmuth.com>
//
// Licensed under the MIT License (the "License"); you may not use this
// file except in compliance with the License. You may obtain a copy of
// the License at: http://opensource.org/licenses/MIT
package com.fnordmetric.enterprise
import scala.collection.mutable.ListBuffer
@asmuth
asmuth / server_monitor.sh
Last active December 12, 2015 03:28
Linux Server Health Monitor (Fyrehose/FnordMetric)
#!/bin/bash
# This scripts sends a JSON message containing system health
# information to a fyrehose channel.
#
# Usage:
# $ ./linux_health_monitor.sh [host] [port] [channel]
# e.g.
# $ ./linux_health_monitor.sh localhost 2323 my_channel
#
@asmuth
asmuth / CSVReader.scala
Created May 7, 2012 01:18
csv reader :)
package com.dawanda.recommender
import scala.collection.JavaConverters._
import scala.collection.mutable.Buffer
import scala.io._
import java.util.concurrent._
class CSVReader[T <: Any](next: (Map[Symbol, Int] => T)){
def read(file_path: String) : Buffer[T] = {