Skip to content

Instantly share code, notes, and snippets.

View tmlbl's full-sized avatar

Tim tmlbl

View GitHub Profile
@tmlbl
tmlbl / build.zig
Created October 19, 2023 16:58
Zig RocksDB test issue
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "csvd",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
@tmlbl
tmlbl / hash.js
Created May 9, 2014 05:38
Simple hash function in JavaScript
String.prototype.hashCode = function(){
var hash = 0;
if (this.length == 0) return hash;
for (i = 0; i < this.length; i++) {
char = this.charCodeAt(i);
hash = ((hash<<5)-hash)+char;
hash = hash & hash; // Convert to 32bit integer
}
return hash;
}
@tmlbl
tmlbl / runner.js
Last active January 23, 2020 19:52
Asynchronous test runner
module.exports = Runner;
function Runner() {
this.stack = [];
this.passed = 0;
this.failed = 0;
}
Runner.prototype.it = function (msg, test) {
this.stack.push(new Test(msg, test));
# Bash snippet for printing things in color
# Examples:
# in_color $GREEN "hello\n"
# in_color $RED "uh oh\n" $BOLD
# ok=$(in_color $GREEN OK $BOLD)
# echo "[ $ok ] Things are good"
__COLOR_RESET='\033[0m'

Keybase proof

I hereby claim:

  • I am tmlbl on github.
  • I am tmlbl (https://keybase.io/tmlbl) on keybase.
  • I have a public key ASDsuUJOF2gOxouFiXBJ3g8EAgd9i80wnXqph5i5eeZWtAo

To claim this, I am signing this object:

# Script to set up the Seastar framework with DPDK on a GCP instance
# Instance should use the stock Ubuntu 16.04 LTS image
apt-get update
apt-get install -y git wget build-essential linux-image-extra-4.15.0-15-generic
export SEASTAR_VERSION=seastar-18.08.0
git clone https://github.com/scylladb/seastar
cd seastar
@tmlbl
tmlbl / dbin.sh
Created June 28, 2018 00:42
Simple script to print out files from a Debian package that fall within the current user's $PATH
#!/bin/bash
# A simple script for listing the files from a Debian package that fall within
# the current user's $PATH
dfiles=$(dpkg -L $1)
if [ ! "$dfiles" ]; then
exit 1
fi
#include <stdio.h>
#include <unistd.h>
typedef struct widget {
double value;
} widget;
void printval(int pid, double val)
{
printf("pid: %d value: %f\n", pid, val);
function isNode(x) {
return typeof x.blur == 'function';
}
function writeStyles(obj) {
var strs = [];
Object.keys(obj).forEach(function (k) {
strs.push(k + ':' + obj[k]);
});
return strs.join(';');
@tmlbl
tmlbl / x-blink.js
Last active September 20, 2017 21:19