Skip to content

Instantly share code, notes, and snippets.

View malkia's full-sized avatar

Dimiter 'malkia' Stanev malkia

View GitHub Profile
@staltz
staltz / introrx.md
Last active May 11, 2025 22:46
The introduction to Reactive Programming you've been missing
@simonhf
simonhf / lmdb-perf-test.txt
Created March 21, 2014 01:34
Performance testing lmdb with 16 concurrent processes & 70 million keys
# # ssh to Rackspace 16 vCPU box to perf test lmdb
# # try to do a similar multi-process test to the one at https://github.com/simonhf/sharedhashfile
# # note: could not figure out how to insert more that 70 million keys; other test inserts 100 million keys
# # note: created lmdb hash file on /dev/shm to make it a fairer test
# # note: as you can see below, inserting is extremely slow but lmdb only claims that reading is lighting fast :-)
# # note: the 'mix' 2% update, 98% read test shows that read performance gets bogged down if reading & writing :-(
# # note: not sure if I am using the lmdb API is the optimum way so please forgive me & suggest changes!
# # note: comments to [email protected] please
# apt-get update
# apt-get install build-essential
@Coopeh
Coopeh / sophosremoval.bat
Created January 17, 2014 08:23
Sophos Removal Script
@ECHO OFF
ECHO ====================================================================
ECHO Sophos Removal v1.0 - Ed Cooper 2014
ECHO Removes Sophos v7 - v10
ECHO ====================================================================
ECHO.
ECHO.
IF NOT EXIST "%~dp0\msizap.exe" GOTO MSIZAPNOTFOUND
ECHO Administrative permissions required. Detecting permissions...
ECHO.
"""
This file contains code that, when run on Python 2.7.5 or earlier, creates
a string that should not exist: u'\Udeadbeef'. That's a single "character"
that's illegal in Python because it's outside the valid Unicode range.
It then uses it to crash various things in the Python standard library and
corrupt a database.
On Python 3... well, this file is full of syntax errors on Python 3. But
if you were to change the print statements and byte literals and stuff:
@grantslatton
grantslatton / fizzbuzz.c
Last active August 19, 2022 11:20
FizzBuzz solved using only bit twiddling. It essentially uses two deterministic finite automata for divisibility testing.
#include <stdio.h>
int f0(unsigned int x) { return x? (x&(1<<31)? f1(x<<1) : f0(x<<1)) : 1; }
int f1(unsigned int x) { return x? (x&(1<<31)? f3(x<<1) : f2(x<<1)) : 0; }
int f2(unsigned int x) { return x? (x&(1<<31)? f0(x<<1) : f4(x<<1)) : 0; }
int f3(unsigned int x) { return x? (x&(1<<31)? f2(x<<1) : f1(x<<1)) : 0; }
int f4(unsigned int x) { return x? (x&(1<<31)? f4(x<<1) : f3(x<<1)) : 0; }
int t0(unsigned int x) { return x? (x&(1<<31)? t1(x<<1) : t0(x<<1)) : 1; }
int t1(unsigned int x) { return x? (x&(1<<31)? t0(x<<1) : t2(x<<1)) : 0; }
int t2(unsigned int x) { return x? (x&(1<<31)? t2(x<<1) : t1(x<<1)) : 0; }
@jbenet
jbenet / simple-git-branching-model.md
Last active May 3, 2025 18:07
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@mattyclarkson
mattyclarkson / LICENSE
Last active November 11, 2023 20:28
Compile time Murmur3_32 implementation using C++11 constexpr
The MIT License (MIT)
Copyright (c) <year> <copyright holders>
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
furnished to do so, subject to the following conditions:
@eahydra
eahydra / pe_checksum.c
Created September 19, 2012 05:03
pe file checksum
unsigned short ChkSum(unsigned int CheckSum, void *FileBase, int Length)
{
int *Data;
int sum;
if ( Length && FileBase != NULL)
{
Data = (int *)FileBase;
do
@geoffleyland
geoffleyland / ray-object.lua
Created July 5, 2012 00:50
Raytrace using vector objects
local sqrt = math.sqrt
local huge = math.huge
local delta = 1
while delta * delta + 1 ~= 1 do
delta = delta * 0.5
end
-- vectors -------------------------------------------------------------------
@geoffleyland
geoffleyland / ray-stack.lua
Created July 5, 2012 00:50
Raytrace avoiding vector objects
local sqrt = math.sqrt
local huge = math.huge
local delta = 1
while delta * delta + 1 ~= 1 do
delta = delta * 0.5
end
-- vectors -------------------------------------------------------------------