Skip to content

Instantly share code, notes, and snippets.

View kevinetienne's full-sized avatar
🌕

Kévin Etienne kevinetienne

🌕
View GitHub Profile
@kevinetienne
kevinetienne / loop.go
Created November 6, 2018 09:55
Infinite loop to get data from a source
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
dataChan := make(chan string)
@kevinetienne
kevinetienne / LICENSE.txt
Created February 15, 2012 13:05 — forked from aemkei/LICENSE.txt
Binary Tetris - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
rsync -arvz --include-from=/Users/kev/filelist.txt -e ssh user@host:/ /dest/ --log-file=/var/log/rsync.cron.log
filelist.txt
+ /
+ /etc/
+ /etc/apache2
+ /etc/apache2/**
- *
@kevinetienne
kevinetienne / find_duplicate.py
Created October 26, 2011 10:06
find duplicate
def find_duplicate(seq):
# holds our duplicate list
duplicate_bucket = []
# helps to identify a duplicate
seen_bucket = set()
for item in (seq):
if item not in seen_bucket:
seen_bucket.add(item)
else:
duplicate_bucket.append(item)
@kevinetienne
kevinetienne / checksqltable
Created October 14, 2011 10:21
check if table exists in sqlite
SELECT name FROM sqlite_master WHERE type='table' AND name='table_name';
@kevinetienne
kevinetienne / hgrc
Created September 29, 2011 09:05
hgrc file
[paths]
default = https://username@bitbucket.org/owner_username/repo
diff = --unified 8
[alias]
# http://hgtip.com/tips/advanced/2010-01-15-styling-mercurials-cli/
# repo https://bitbucket.org/sjl/mercurial-cli-templates/src
slog = log --style=/Path/to/mercurial-cli-templates/map-cmdline.slog
sglog = log --style=/Path/to/mercurial-cli-templates/map-cmdline.sglog
@kevinetienne
kevinetienne / js-quickstart.sh
Created August 27, 2011 11:46
use maven and javascript-quickstart archetype
#!/bin/bash
# js-quickstart.sh: creates a js project with maven and Jasmine
usage(){
echo "Usage: $0 com.company.id folder"
echo "Example: $0 com.example.quickstart quickstart"
exit 1
}
# invokes usage if com.company.id and folder not supplied
@kevinetienne
kevinetienne / makepwd.sh
Created May 9, 2011 13:27
password generator (mac os)
#!/bin/bash
echo `env LC_CTYPE=C tr -dc "a-zA-Z0-9′\!”.$%&/()=?|@#[]{}-_.:,;’" < /dev/urandom | head -c 20`
@kevinetienne
kevinetienne / color.c
Created May 3, 2011 20:34
playing with term color
/* Set the color : only for Linux
*
* with bash
* foreground \33[38;5;${code}m
* background \33[48;5;${code}m
*
* with c
* fg: \e[38;5;codem
* bg: \e[45;5;codem
*
@kevinetienne
kevinetienne / utils.js
Created February 7, 2011 22:56
String formatting for javascript
// thanks to http://stackoverflow.com/questions/610406/javascript-printf-string-format/3492815#3492815
// very similar to string.format:
// "{0} is dead, but {1} is alive!".format("ASP", "ASP.NET")
String.prototype.format = function() {
var formatted = this;
var args = Array.prototype.slice.call(arguments);
for(var i=0; args.length > i ;i++) {
formatted = formatted.replace("{" + i + "}", args[i]);
}