Skip to content

Instantly share code, notes, and snippets.

View tvlooy's full-sized avatar
🐧
<(o)

Tom Van Looy tvlooy

🐧
<(o)
View GitHub Profile
@tvlooy
tvlooy / endian.c
Created November 21, 2014 21:55
determine endian type
/* endian.c */
#include <stdio.h>
char *bytesex() {
char geheugenblok[8];
unsigned short *pointershort = (unsigned short *)geheugenblok;
unsigned long *pointerlong = (unsigned long *)geheugenblok;
*pointershort = 0x0d0c;
@tvlooy
tvlooy / fizzbuzz.scm
Last active August 29, 2015 14:10
xpdays 2015 fizzbuzz kata
; https://github.com/hightechict/fp-and-tdd/
load "~/.bin/check.scm")
(check-set-mode! 'report-failed)
(define divisible-by
(lambda (value divisor)
(= (modulo value divisor) 0)))
(define digits-split
(lambda (value)
@tvlooy
tvlooy / fizzbuzz.php
Last active August 29, 2015 14:10
"functional php" fizzbuzz kata
<?php
function test($message, $received, $expected) {
if ($received === $expected) {
echo "\033[32m✔︎ Tested $message\n";
} else {
echo "\033[31m✘ Tested $message\n";
echo "Received:\n";
var_dump($received);
echo "Expected:\n";
@tvlooy
tvlooy / gist:e2be8355a95627903d74
Created December 22, 2014 09:10
Set github oauth token
Github -> Account Settings -> Applications -> Personal Access Tokens
composer.phar config --global github-oauth.github.com <oauth-token>
@tvlooy
tvlooy / gist:b73fffdfd3c0d8697193
Created December 22, 2014 11:05
Shell reuse history
vi ~/.inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
set show-all-if-ambiguous on
set completion-ignore-case on
# type ls, use arrows to get last directory you used
module InventoryItems(Command(..), Event(..), handle) where
import Data.Maybe(isJust)
type Id = String
type Name = String
type Amount = Int
data Command = CreateInventoryItem Id
| RenameInventoryItem Id Name
@tvlooy
tvlooy / intl_date_formatter.php
Created January 24, 2015 20:46
Translate datetime format
$d = new DateTime();
$x = new IntlDateFormatter('nl_BE', IntlDateFormatter::NONE, IntlDateFormatter::NONE, null, null, 'd MMMM Y - H:mm:ss');
echo $x->format($d) . "\n";
// output 24 januari 2015 - 21:45:16
@tvlooy
tvlooy / pt-duplicate-key-checker_Drupal8.txt
Created February 20, 2015 20:22
pt-duplicate-key-checker on Drupal 8 (after this patch https://www.drupal.org/node/2428297)
root@Debian77:~# pt-duplicate-key-checker --user=root --password=vagrant --database=drupal8
# ########################################################################
# drupal8.url_alias
# ########################################################################
# Key source_langcode_pid ends with a prefix of the clustered index
# Key definitions:
# KEY `source_langcode_pid` (`source`,`langcode`,`pid`)
# PRIMARY KEY (`pid`),
# Column types:
@tvlooy
tvlooy / howto.md
Created July 14, 2015 19:42
How to build jworklog

How to build tojans jworklog on Linux

Clone the project:

$ git clone https://github.com/ToJans/jworklog.git
Cloning into 'jworklog'...
remote: Counting objects: 39, done.
remote: Compressing objects: 100% (30/30), done.
remote: Total 39 (delta 8), reused 36 (delta 5), pack-reused 0
@tvlooy
tvlooy / selenium-server.sh
Created July 27, 2015 15:52
Selenium server init script
#!/bin/bash
NAME=selenium-server
SCRIPT="/usr/bin/xvfb-run -- java -jar /root/${NAME}-standalone-2.44.0.jar"
PIDFILE=/var/run/selenium-server.pid
case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --exec $SCRIPT