Skip to content

Instantly share code, notes, and snippets.

View phuysmans's full-sized avatar

Philippe Huysmans phuysmans

View GitHub Profile
@phuysmans
phuysmans / i3config
Created February 4, 2019 08:54 — forked from NeoTheFox/i3config
My daily i3 config
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
@phuysmans
phuysmans / dawg.py
Created June 18, 2018 08:24 — forked from smhanov/dawg.py
Use a DAWG as a map
#!/usr/bin/python3
# By Steve Hanov, 2011. Released to the public domain.
# Please see http://stevehanov.ca/blog/index.php?id=115 for the accompanying article.
#
# Based on Daciuk, Jan, et al. "Incremental construction of minimal acyclic finite-state automata."
# Computational linguistics 26.1 (2000): 3-16.
#
# Updated 2014 to use DAWG as a mapping; see
# Kowaltowski, T.; CL. Lucchesi (1993), "Applications of finite automata representing large vocabularies",
# Software-Practice and Experience 1993
@phuysmans
phuysmans / README.md
Created April 12, 2018 11:16 — forked from eddiejaoude/README.md
Install Firefox addon/extension with no user interaction
@phuysmans
phuysmans / gist:3d2fea2e74351c4980243e6613557e28
Created March 27, 2018 07:57
haproxy mixed mode ssl termination passthrough
global
log 127.0.0.1 local0 debug
chroot /var/lib/haproxy
stats socket /var/lib/haproxy/admin.sock level admin
pidfile /var/lib/haproxy/pid
stats timeout 30s
daemon
tune.ssl.default-dh-param 2048
ssl-server-verify none
crt-base /etc/ssl/certs/
@phuysmans
phuysmans / ngrok-selfhosting-setup.md
Created March 27, 2018 07:55 — forked from longle255/ngrok-selfhosting-setup.md
How to setup Ngrok with a self-signed SSL cert

Intro

The plan is to create a pair of executables (ngrok and ngrokd) that are connected with a self-signed SSL cert. Since the client and server executables are paired, you won't be able to use any other ngrok to connect to this ngrokd, and vice versa.

DNS

Add two DNS records: one for the base domain and one for the wildcard domain. For example, if your base domain is domain.com, you'll need a record for that and for *.domain.com.

Different Operating Systems

@phuysmans
phuysmans / ip_in_range.php
Created March 5, 2018 10:27 — forked from tott/ip_in_range.php
php check if IP is in given network range
/**
* Check if a given ip is in a network
* @param string $ip IP to check in IPV4 format eg. 127.0.0.1
* @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed
* @return boolean true if the ip is in this range / false if not.
*/
function ip_in_range( $ip, $range ) {
if ( strpos( $range, '/' ) == false ) {
$range .= '/32';
}
@phuysmans
phuysmans / gist:4f67a7fa1b0c6809a86f014694ac6c3a
Created January 8, 2018 09:29
docker compose health check example
version: '2.1'
services:
php:
tty: true
build:
context: .
dockerfile: tests/Docker/Dockerfile-PHP
args:
version: cli
volumes:
@phuysmans
phuysmans / parsing-binary-file.go
Created October 17, 2017 10:05 — forked from jpetitcolas/parsing-binary-file.go
How to parse a binary file in Go? Snippet based on MoPaQ SC2 replay parsing. Related blog post: http://www.jonathan-petitcolas.com/2014/09/25/parsing-binary-files-in-go.html
package main
import (
"bytes"
"encoding/binary"
"fmt"
"log"
"os"
)
@phuysmans
phuysmans / Readme.md
Created October 17, 2017 08:17 — forked from druminski/Readme.md
BigCache service example with external benchmarks

Cache service example. It uses fasthttp as an http server and bigcache as the cache.

External benchmarks are provided.

Running cache service

go run main.go

Server listens on 8080 port.

@phuysmans
phuysmans / README.md
Created October 17, 2017 08:08 — forked from joyrexus/README.md
boltdb demo