Skip to content

Instantly share code, notes, and snippets.

View jpcaruana's full-sized avatar

Jean-Philippe Caruana jpcaruana

View GitHub Profile
@mikeatlas
mikeatlas / sync_ftp_to_s3.md
Last active January 12, 2018 15:54
syncing ftp to s3 one-time really fast.

Original idea from Transfer files from an FTP server to S3 by "Hack N Cheese".

I moved roughly a terrabyte in less than an hour. Granted, I couldn't take advantage of lftp's --parallel=30 switch due to my ftp source limiting me to one connection at a time, but use-pget-n=N did seem to help out.

  • Get a fast Ubuntu 14.4 EC2 box on Amazon for temporary usage (I went with m1.xlarge) so data tranfers aren't limited by your local bandwidth at least. I also attached a fat 2TB EBS volume and symlinked it to /bigdisk, and made sure the EBS volume was deleted after I terminated this EC2 box. I hope lftp 2.6.4 is available as a stable package by the next time I attempt this.
  • Build lftp 2.6.4+ (Not easy to compile, so read the INSTALL file and plow through all your missing dependencies - you'll also need to re-run `sudo ./configure && su
@vcarel
vcarel / .jshintrc
Last active December 5, 2016 15:35
Bootstrap for static websites with Grunt and Webmake (featuring Stylus, cssmin, htmlmin, jshint...)
{
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": false,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"unused": true,
@BlakeGardner
BlakeGardner / compact.js
Last active February 19, 2024 16:55
Compact all collections inside of a MongoDB database
// This script loops though the list of collection names in a MongoDB and runs the compact operation on them
// Simply paste this into the Mongo shell
use testDbName;
db.getCollectionNames().forEach(function (collectionName) {
print('Compacting: ' + collectionName);
db.runCommand({ compact: collectionName });
});
@jbpotonnier
jbpotonnier / Reco.hs
Last active December 19, 2015 09:59
Recommend products based on sales. There is an approximation when sorting by sales, considering the wholes sales, when only the sales of people having bought the same product should be used. The data structure could be easily implemented in Redis ;)
module Reco where
import Prelude hiding (product)
import qualified Data.Set as Set
import Data.Set(Set)
import qualified Data.Map as Map
import Data.Map(Map)
import Data.List(sortBy)
import Data.Ord (comparing)
@lmazardo
lmazardo / workflow_git.txt
Last active November 29, 2016 10:07
brouillon de workflow git
Un bon workflow pour git serait le suivant :
- avoir tout le temps branche distante _master_ :
* personne ne travaille directement dessus
* les tests automatiques passent dessus
* correspondant au code de production
- avoir tout le temps branche distante de développement _dev_ :
* future branche _master_
* développements en cours stable
@jbpotonnier
jbpotonnier / fizzbuzz.hs
Created August 3, 2012 21:12
My fizz/buzz in Haskell and its direct translation in Python (inspired from http://www.free-variable.org/2009/07/were-not-in-kansas-anymore-toto/ ).
fizz = cycle ["", "", "fizz"]
buzz = cycle ["", "", "", "", "buzz"]
numbers = map show [1..]
combine "" "" number = number
combine "fizz" "buzz" _ = "Fizz buzz!"
combine "fizz" _ _ = "Fizz!"
combine _ "buzz" _ = "Buzz!"
fizzbuzz = zipWith3 combine fizz buzz numbers
@jbpotonnier
jbpotonnier / switch_dv_fr
Created July 18, 2012 09:09
Switch between dvorak and fr keyboard. I map it using my window manager
#!/bin/bash
kbd=`setxkbmap -query | grep layout | awk '{print $2}'`
if [ 'fr' = $kbd ]
then
notify-send 'Keyboard is now Dvorak'
setxkbmap dvorak en -option compose:ralt
else
notify-send 'Keyboard is now French'
@jbpotonnier
jbpotonnier / .gitignore
Created February 16, 2012 19:53
[Flask] Routing with class
bin
include
lib
local
*.swp
*.pyc
@bamthomas
bamthomas / mod_http_presence.erl
Created December 14, 2011 10:10
module http ejabberd
-module(mod_http_presence).
-behavior(gen_mod).
-include("ejabberd.hrl").
-include("jlib.hrl").
-export([start/2, stop/1, on_presence/4]).
start(Host, _Opts) ->
@jbpotonnier
jbpotonnier / nimportequoi.py
Created December 8, 2011 16:10
fun avec bottle, pystache et ... redis
from bottle import Bottle
import bottle
import pystache
import redis
import json
app = Bottle()
redisse = redis.Redis()
def mustache(template, context):