Skip to content

Instantly share code, notes, and snippets.

View etcimon's full-sized avatar

Etienne Cimon etcimon

View GitHub Profile
@etcimon
etcimon / stack_traces.c
Created October 4, 2015 18:10 — forked from jvranish/stack_traces.c
An example of catching exceptions and printing stack traces in C on Windows, Linux and OS X
/* compile with:
on linux: gcc -g stack_traces.c
on OS X: gcc -g -fno-pie stack_traces.c
on windows: gcc -g stack_traces.c -limagehlp
*/
#include <signal.h>
#include <stdio.h>
#include <assert.h>
@etcimon
etcimon / ie-test.vbs
Created September 13, 2015 18:11
Internet explorer desktop application
On Error Resume Next
AppURL = "http://google.com"
AppToRun = "iexplore about:blank"
AboutBlankTitle = "Blank Page"
LoadingMessage = "Loading Google..."
ErrorMessage = "An error occurred while loading google. Please close the Internet Explorer with Blank Page and try again."
EmptyTitle = ""
'Launch Internet Explorer in a separate process as a minimized window so we don't see the toolbars disappearing
@etcimon
etcimon / chrome-test.vbs
Last active September 13, 2015 18:10
chrome desktop application
On Error Resume Next
AppToRun = "chrome --app=http://google.com/ --app-shell-host-window-size=1024,740 --window-position=10,10"
dim WshShell
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run AppToRun, 1
if (Err.Number <> 0) then
WScript.Quit 1
end if
// Replace real geolocation with mock geolocation
delete navigator.geolocation;
navigator.geolocation = {
isMock: true,
paused: true,
delay: 100,
shouldFail: false,
failsAt: -1,
unFailsAt: -1,
errorMessage: "There was an error retrieving the position!",
@etcimon
etcimon / gist:518b15072e9006110c5e
Created July 24, 2015 17:05
postgresql + vibe.d
PostgresDB g_pgdb;
auto connectDB() {
if (!g_pgdb) {
g_pgdb = new PostgresDB([
"host" : "127.0.0.1",
"database" : "",
"user" : "",
"password" : ""
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import select
import psycopg2
import psycopg2.extensions
dbc = psycopg2.connect(database='depesz', host='127.0.0.1', port=5920)
Task 1A10A2BC00 (5840 B) [HTTP Request] [127.0.0.1:2130 > POST > /crop]
[HTTPServerRequest.headers]
HTTP/1.1 POST /crop
Date: Fri, 10 Jul 2015 17:22:19 GMT
Host: localhost:4343
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
case LANG_AFRIKAANS:
return "af";
case LANG_ALBANIAN:
return "sq";
case LANG_ALSATIAN:
return "gsw";
case LANG_AMHARIC:
return "am";
case LANG_ARABIC:
return "ar";
@etcimon
etcimon / gist:183ff4f446c51feab07e
Created December 4, 2014 20:26
botan versions all
"SIMD_Scalar", "Locking_Allocator", "RT_Test", "RT_Test_Priv", "RT_Test_Priv_Gen", "AES_NI", "Serpent_x86_32", "MD4_x86_32", "MD5_x86_32", "SHA1_x86_64", "SHA1_x86_32", "CFB", "ECB", "CBC", "XTS", "OFB", "CTR_BE", "AEAD_FILTER", "AEAD_CCM", "AEAD_EAX", "AEAD_OCB", "AEAD_GCM", "RFC6979", "RSA", "RW", "DLIES", "DSA", "ECDSA", "ElGamal", "GOST_3410", "Nyberg_Rueppel", "Diffie_Hellman", "ECDH", "AES", "Blowfish", "Camellia", "CAST", "Cascade", "DES", "GOST_28147", "IDEA", "KASUMI", "LION", "MARS", "MISTY1", "NOEKEON", "RC2", "RC5", "RC6", "SAFER", "SEED", "Serpent", "TEA", "Twofish", "Threefish", "XTEA", "Adler32", "CRC24", "CRC32", "GOST_3411", "HAS_160", "Keccak", "MD2", "MD4", "MD5", "RIPEMD_128", "RIPEMD_160", "SHA1", "SHA2_32", "SHA2_64", "Skein_512", "Tiger", "Whirlpool", "ParallelHash", "Comb4P", "CBC_MAC", "CMAC", "HMAC", "SSL3_MAC", "ANSI_X919_MAC", "PBKDF1", "PBKDF2", "RC4", "ChaCha", "Salsa20", "AES_SSSE3", "Serpent_SIMD", "Threefish_512_AVX2", "Noekeon_SIMD", "XTEA_SIMD", "IDEA_SSE2", "SHA1_SSE2", "En
@etcimon
etcimon / uuidv1.d
Last active August 29, 2015 14:08
UUID v1
import std.datetime;
import std.stdio;
import std.conv;
import std.random;
import std.uuid;
/* use implib to generate a iphlpapi.lib file for windows DMD. The .def file is:
LIBRARY "IPHLPAPI.dll"
EXPORTS