Skip to content

Instantly share code, notes, and snippets.

alias cdd='cd ~/Dev/'
alias app='ap -i inventories/perso_inventory'
alias pw="pwgen -yBn 16"
alias python-build="python3 setup.py sdist bdist_wheel"
alias gis="git status"
alias gico="git checkout"
alias gicm="git commit -s"
alias giap="git add -ip"
alias gm="git checkout main"
function giclean() {
@jillro
jillro / exress_async_wrapper.js
Created June 7, 2017 10:13
A one line wrapper to use async function in express.
const wrap = fn => (...args) => fn(...args).catch(args[2]);
@jillro
jillro / nginx.conf
Created March 15, 2017 11:07
Nginx config
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
@jillro
jillro / example.py
Last active September 27, 2016 16:20
for event in events.copy():
if countTweets(event) > 20:
hashtags = getFields(event, "hashtags.raw")["aggregations"]["fields"]["buckets"]
if hashtags != [] and hashtags[0]['doc_count'] > 10:
text = " ".join([n['doc_count']*(n['key']+" ") for n in hashtags ])
collection.append(text)
else:
events.remove(event)
else: events.remove(event)
@jillro
jillro / in-memory-cache.js
Last active May 4, 2016 12:21
A simple Javascript in memory cache with timestamp.
// Cache object
var cache = {};
var getInCache = (name, date) => {
var noDate = (typeof date === 'undefined');
if (cache[name] && (noDate || cache[name].date.getTime() > date.getTime())) {
//debug('Hit ' + name + ' in cache.');
return cache[name].data;
}
@jillro
jillro / letsencrypt_params
Created March 31, 2016 09:33
File to include in my server nginx conf.
location ~ /.well-known {
root /var/www/letsencrypt/;
try_files $uri =404;
allow all;
}
# $Id: screenrc,v 1.15 2003/10/08 11:39:03 zal Exp $
#
# /etc/screenrc
#
# This is the system wide screenrc.
#
# You can use this file to change the default behavior of screen system wide
# or copy it to ~/.screenrc and use it as a starting point for your own
# settings.
#
this.loginUser = function(user, callback) {
//plans for changing this to promises once i do error reporting
// var q = Q.defer();
// if() {
// q.resolve(num+1);
// } else {
// q.reject("error message");
// }
// return q.promise;