Skip to content

Instantly share code, notes, and snippets.

View DanielG's full-sized avatar

Daniel Gröber (dxld) DanielG

View GitHub Profile
@DanielG
DanielG / uml-dir-fsync-bug.c
Created January 11, 2015 23:39
uml-dir-fsync-bug
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
DIR* d = opendir("/");
int fd = dirfd(d);
### Keybase proof
I hereby claim:
* I am DanielG on github.
* I am dxld (https://keybase.io/dxld) on keybase.
* I have a public key whose fingerprint is 57A1 BF15 B4F6 F99B 89ED B29F D394 81AE 1E79 ACF7
To claim this, I am signing this object:
################################################################################
# #
# Find version differences in common packages of `ghc-pkg list` dumps. #
# #
# Copyright (C) 2015 Daniel Gröber <dxld@darkboxed.org> #
# #
# Copying and distribution of this file, with or without modification, #
# are permitted in any medium without royalty provided the copyright #
# notice and this notice are preserved. This file is offered as-is, #
# without any warranty. #
@DanielG
DanielG / PrintBinary.h
Created March 27, 2010 13:27
Print any type as binary with automatic endian swap
#include <iostream>
#include <vector>
#include <stdarg.h>
#include <stdint.h>
enum printBinary_opt
{
kPB_NO_OPT = 0,
kPB_LITTLE_ENDIAN = 1,
kPB_BIG_ENDIAN = (1 << 1),
cmake_minimum_required(VERSION 2.6)
project(ogre-test)
include("CMake/setup-module-path.cmake")
include("CMake/FindOgre-all.cmake")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" CACHE PATH "Binary output directory" FORCE)
# Find all .cpp files and compile them
file (GLOB OGRE_TEST_SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
@DanielG
DanielG / A.hs
Last active September 10, 2015 03:39
module A where
foo = 123
-- $ ghc -package ghc -package ghc-paths GhcTestcase.hs
module Main where
import GHC
import GHC.Paths (libdir)
import DynFlags
import CoreMonad
import Pretty
import PprTyThing
import Outputable
#! /usr/bin/env node
// Very simple c/++ preprocessor for replacing binary(0b10101) with the hexer decimal representation
var fs = require('fs');
process.argv = process.argv.slice(2, process.argv.length);
console.log('Arguments:', process.argv);
process.argv.forEach(function(val, index, array){
if(val.match(/[a-zA-Z._-]*/)) {
process.nextTick(function (){
@DanielG
DanielG / smtp-server.js
Created November 22, 2010 20:06
Hacky node.js smtp server
// SMTP server in node.js (hacky)
var util = require('util');
var net = require('net');
/*
* Template
=== Trying 127.0.0.1:25...
=== Connected to 127.0.0.1.
<- 220 Dexter ESMTP Exim 4.72 Mon, 22 Nov 2010 13:59:05 +0100
-> EHLO Dexter
@DanielG
DanielG / todo.mdown
Created December 28, 2010 03:22
My Unhosted todo list
  • crypto.sessionKey() #DONE
  • protocol versioning, crypto versions
  • asnyc retrieveKey for automatic key retrieve from keyserver
  • async decryption for images and such (low priority ?)
  • .. or WebWorkers