Skip to content

Instantly share code, notes, and snippets.

View harmo's full-sized avatar

David Talagrand harmo

View GitHub Profile
{
// set python interpreter (lint files for python >= 2.7):
// - 'internal' for use internal Sublime Text 2 interpreter (2.6)
// - 'auto' for search default system python interpreter (default value)
// - absolute path to python interpreter for define another one
"python_interpreter": "auto",
// turn on pyflakes error lint
"pyflakes": true,
// turn on pep8 error lint
# -*- coding: utf-8 -*-
"""
0 ________ 256
| /\ |
| /\/\ |
| /\/\/\ |
|/\/\/\/\| \ → x
|\/\/\/\/|
| \/\/\/ | / → y
| \/\/ |
@harmo
harmo / moussaka.md
Last active December 28, 2015 04:09

##Moussaka

###Ingrédients:

  • 2 grosses aubergines
  • 6 pommes de terre
  • 500 g de boeuf haché
  • 5 tomates (+/- une demie brique de coulis de tomate)
  • 1 oignon
  • de l'huile d'olive
  • 30 g de beurre
@harmo
harmo / Duplicates.sql
Last active December 18, 2016 09:26
Postgresql request to find duplicates
SELECT * FROM (
SELECT id[, other_fields…] ROW_NUMBER() OVER(PARTITION BY <field to search duplicates>) AS row
FROM <table>
) duplicates
WHERE duplicates.row > 1;
-------------------------------------------------------------------------------
SELECT <field to search duplicates>, COUNT(*) FROM <table> GROUP BY <field to search duplicates> HAVING COUNT(*) > 1;
@harmo
harmo / django migration.txt
Last active December 18, 2016 09:28
Migration Django vers 1.4.5, puis vers 1.5
pip install -U "django < 1.5"
service memcached restart
# Remove old setting call DATABASE_ENGINE
----------------------------------------------------------------------------------------
pip install -U django
@harmo
harmo / sublime_code_intel_config.settings
Created July 19, 2013 17:59
Sublime code intel config
/*
SublimeCodeIntel default settings
*/
{
/*
Sets the mode in which SublimeCodeIntel runs:
true - Enabled (the default).
false - Disabled.
*/
<?php
public static function my_exec($cmd, $input = '', $outputFile = ''){
$proc = proc_open($cmd, array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('file', $outputFile, 'w')), $pipes);
fwrite($pipes[0], $input);
fclose($pipes[0]);
$stdout = stream_get_contents($pipes[1]);fclose($pipes[1]);
$rtn = proc_close($proc);
return array(
'stdout'=>$stdout,
@harmo
harmo / create_manifest.php
Last active December 18, 2016 09:30
Function for create a MANIFEST file since makefile content Based on the first # before each target
<?php
$salt = 'zo5pro$1pvkhj6*cz4a8ùtvb#ui4oeuio';
$aFunctions = array();
$file = explode("\n", file_get_contents('makefile'));
if(!empty($file)){
foreach ($file as $key => $line) {
if(preg_match('/^#(.+)$/', $line, $matches) !== false && !empty($matches)){
$aFunctions[] = array(
'label' => $matches[1],
'target' => $file[$key + 1],
loadkeys fr

parted -s /dev/sd<n> mklabel gpt
parted -s /dev/sd<n> mkpart "primary" "fat16" "50MB" "150MB"
parted -s /dev/sd<n> mkpart "primary" "linux-swap" "151MB" "9367MB"
parted -s /dev/sd<n> mkpart "primary" "ext4" "<start>" "<end>"
parted -s /dev/sd<n> set 1 bios_grub on
mkfs.ext4 /dev/sd<n>3
mount /dev/sd<n>3 /mnt
<?php
class MinecraftServerStatus {
private $timeout;
/**
* Prepares the class.
* @param int $timeout default(3)
*/
public function __construct($timeout = 3) {