Skip to content

Instantly share code, notes, and snippets.

View GromNaN's full-sized avatar
🚲
☀️

Jérôme Tamarelle GromNaN

🚲
☀️
View GitHub Profile
@GromNaN
GromNaN / gist:1342799
Created November 6, 2011 12:19
Pause process
# Find the process ID
ps -ax | grep Safari
# Pause the process
kill -STOP 1234
# Resume the process
kill -CONT 1234
@GromNaN
GromNaN / Doctrine_Connection_Mssql.php
Created November 10, 2011 16:53
Doctrine_Connection_Mssql with optimized modifyLimitQuery()
<?php
/*
* $Id: Mssql.php 5804 2009-06-02 19:52:42Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
@GromNaN
GromNaN / autoload.php
Created November 29, 2011 14:20
PSR-0 autoload.php
<?php
/**
* Simple autoloader that follow the PHP Standards Recommendation #0 (PSR-0)
* @see https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md for more informations.
*
* Code inspired from the SplClassLoader RFC
* @see https://wiki.php.net/rfc/splclassloader#example_implementation
*/
spl_autoload_register(function($className) {
@GromNaN
GromNaN / console-colors.md
Created December 8, 2011 09:43
Console Colors

Characters Codes to get color in your console

Reset

  • reset \033[0

Text Colors

@GromNaN
GromNaN / gist:1560785
Created January 4, 2012 16:24
Track GIT changes into SVN
# Track changes from a GIT repository as snapshots into SVN
SVN_REPOS=<svn_repos>
GIT_REPOS=<git_repos>
GIT_BRANCH=<branch>
git svn clone $SVN_REPOS repos
cd repos
git remote add origin $GIT_REPOS
git fetch origin
function refreshIframeHeight(id) {
parent.window.document.getElementById(id).height = document.body.offsetHeight ;
}
@GromNaN
GromNaN / composer.json
Created March 15, 2012 23:26
Redirection
{
"name": "jerometamarelle/redirect",
"require": {
"silex/silex": "dev-master"
},
"authors": [
{
"name": "Jérôme Tamarelle",
"email": "jerome@tamarelle.net"
}
@GromNaN
GromNaN / latency.txt
Created July 5, 2012 16:42 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@GromNaN
GromNaN / mirror-git.sh
Created August 30, 2012 15:54
Mirror Git repositories
# This commands to keep in sync a clone of a Git repository
ORIGIN=https://github.com/symfony/symfony.git
MIRROR=git@gitlab.xxx.com
BARE=~/mirror/symfony.git
# First clone
git clone --bare ${ORIGIN} ${BARE}
cd ${BARE}
@GromNaN
GromNaN / MirrorCommand.php
Created October 3, 2012 16:30
Satis Mirror repositories
<?php
/*
* This file is part of Satis.
*
* (c) Jordi Boggiano <j.boggiano@seld.be>
* Nils Adermann <naderman@naderman.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.