Skip to content

Instantly share code, notes, and snippets.


Jonathan Petitcolas jpetitcolas

View GitHub Profile
jpetitcolas / Makefile
Created Jan 27, 2015
Playing with websockets in Go
View Makefile
docker run \
--rm \
--volume="`pwd`:/srv" \
--tty \
--interactive \
--publish="8080:8080" \
marmelab/go run src/marmelab/gollabedit/*.go
jpetitcolas / parsing-binary-file.go
Last active Jul 27, 2020
How to parse a binary file in Go? Snippet based on MoPaQ SC2 replay parsing. Related blog post:
View parsing-binary-file.go
package main
import (
jpetitcolas / pre-commit
Created Aug 12, 2014
My standard Git pre-commit hook
View pre-commit
# Based on post
# Do not forget to: chmod +x .git/hooks/pre-commit
BAD_TWIG_WORDS='{{ dump(.*) }}'
jpetitcolas / issue.php
Last active Aug 29, 2015
Issue with Document Manager
View issue.php
// Controller
$tag = new Tag();
$this->getContainer()->get('my_service')->import($content, $tag);
// Service
jpetitcolas /
Created Apr 2, 2014
Cleaning all Docker containers and images
sudo docker stop $(sudo docker ps -a -q)
sudo docker rm $(sudo docker ps -a -q)
sudo docker rmi $(sudo docker images -a -q)
jpetitcolas / Split big files into several smaller
Created Mar 24, 2014
Split a big file into several parts with Linux
View Split big files into several smaller
# Splitting file into smaller parts
split --bytes=512M bigfile prefix
# Joining all file parts
cat prefix* > bigfile
jpetitcolas / Finding all test files not included in PHPUnit
Last active Aug 29, 2015
Finding all test files not included in PHPUnit testsuite
View Finding all test files not included in PHPUnit
find src/ -type f -name *Test.php -exec grep -H -c "@group" {} \; | grep :0\$ | awk -F':' '{ print $1 }'
jpetitcolas /
Created Nov 30, 2013
Vagrant bootstraping script for PHP project
#!/usr/bin/env bash
# Install common environment
apt-get update
apt-get install -y curl
# Install Git and configure it (useful when working on Windows)
apt-get install -y git-core
git config --global color.ui auto
git config --global core.filemode false
jpetitcolas /
Created Nov 26, 2013
mysqldump of only n records
mysqldump --opt --where="1 limit 1000000" database table > dump.sql