Skip to content

Instantly share code, notes, and snippets.

diff --git a/example/redblack.c b/example/redblack.c
index f9b247d..de77667 100644
--- a/example/redblack.c
+++ b/example/redblack.c
@@ -1,6 +1,8 @@
#include <stdio.h>
#include <stdlib.h>
+#include <valgrind/mctracer.h>
+
@jcaesar
jcaesar / gist:3049542
Created July 4, 2012 21:12
Test client for grnvsa3
/*
Streaming speed test.
WTFPL!
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
@jcaesar
jcaesar / execution
Created July 16, 2012 20:29
TED Break
michaeli@lxhalle ~/coding
$ g++ -std=c++0x -O3 sha1m.cpp
michaeli@lxhalle ~/coding
$ time ./a.out
6e5a2b6d164557be546a0f17e441dcfafe7938a9 collides with test which is 2C000001
004272ba8922de44bceef49f01dccd6f81f9b997 collides with c1 which is 2CDEC8A7
real 0m28.644s
user 0m28.330s
@jcaesar
jcaesar / FormHelpers.hs
Created December 5, 2012 22:24
Parser for TUM.In.Fp.WS12.Form_8
{-
- FormHelpers.hs
-
- Copyright (c) 2012 Julius Michaelis
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
@jcaesar
jcaesar / Makefile
Last active May 24, 2019 04:40
Example of my style of makefile build configuration
include config
somefile: config
cat >$@ <<<"$(CONFIGVALUE)"
config: config.default
@if [ -e config ]; then \
echo Warning: default config newer than config; \
else \
cp -v $< $@; \
[ 198.744533] usb 4-2: new SuperSpeed USB device number 2 using xhci_hcd
[ 198.758302] usb 3-2: new high-speed USB device number 3 using xhci_hcd
[ 198.925960] usb 3-2: New USB device found, idVendor=2109, idProduct=2811
[ 198.925965] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 198.925967] usb 3-2: Product: USB2.0 Hub
[ 198.925969] usb 3-2: Manufacturer: VIA Labs, Inc.
[ 198.926764] hub 3-2:1.0: USB hub found
[ 198.927260] hub 3-2:1.0: 4 ports detected
[ 198.994531] usb 4-2: New USB device found, idVendor=2109, idProduct=8110
[ 198.994535] usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
@jcaesar
jcaesar / barkdog
Created September 27, 2016 14:29 — forked from anonymous/barkdog
barkdog
#!/bin/bash
set -e -u -x
oldlist=""
declare -A idi
current='' # '' codes for "do nothing with that window"
xprop -spy -root _NET_CLIENT_LIST _NET_ACTIVE_WINDOW |\
while read info; do
@jcaesar
jcaesar / make-me-a-debian.sh
Created May 12, 2019 04:59
qemu auto debian
#!/bin/bash
set -e -u -x
qemu-img create -f qcow2 ${1}.qcow2 8G
virt-install --connect=qemu:///session \
--name=${1} \
--virt-type=kvm \
--ram=2048 \
@jcaesar
jcaesar / docker-run-example.sh
Created May 24, 2019 04:35
Cargo in docker with somewhat working build caching
#!/usr/bin/env bash
set -eu
cd "$(dirname "$0")"
DOCKERF="$(cat <<EOF
FROM debian
RUN apt update && apt -yq install sudo build-essential libclang-dev clang curl # extra hoops for rdkafka
RUN echo 'rust ALL=(ALL:ALL) NOPASSWD:ALL' >>/etc/sudoers
@jcaesar
jcaesar / playground.rs
Last active October 21, 2020 00:20 — forked from rust-play/playground.rs
Get class path from java class file
fn main() -> anyhow::Result<()> {
println!("{}", get_name(include_bytes!("../Class.class"))?);
Ok(())
}
fn get_name(cf: &[u8]) -> anyhow::Result<String> {
use anyhow::Context;
use classfile_parser::constant_info::ConstantInfo::{Class, Utf8};
use classfile_parser::constant_info::ClassConstant;