Skip to content

Instantly share code, notes, and snippets.

View aseigneurin's full-sized avatar

Alexis Seigneurin aseigneurin

View GitHub Profile
@aseigneurin
aseigneurin / parse.js
Created November 18, 2013 09:53
Parse a JSON file and output a SQL script with Node.js.
var fs = require('fs');
var data = fs.readFileSync(process.argv[2], {
encoding: 'ascii'
});
var json = JSON.parse(data);
for (var list in json) {
var devices = json[list];
for (var i = 0; i < devices.length; i++) {
#!/bin/bash
if [ "$#" -ne 4 ]; then
echo "Usage: $0 SOURCE_REPO SOURCE_MODULE TARGET_REPO TARGET_MODULE" >&2
echo "Example: $0 git@...:src_repo src_module git@...:target_repo target_module" >&2
exit 1
fi
SOURCE_REPO=$1
SOURCE_MODULE=$2
TARGET_REPO=$3
@aseigneurin
aseigneurin / app.js
Created November 26, 2013 17:19
Read JSON from a REST API, turn that into SQL requests, execute the SQL request against a SQL Server DB.
var fs = require('fs');
var http = require('http');
var nodemailer = require('nodemailer');
var dbServer = '...';
var dbName = '...';
var dbUser = '...';
var dbpassword = '...';
var smtpHost = '...';
var mailFrom = '...';
@aseigneurin
aseigneurin / A Tour of Go - Exercise: Equivalent Binary Trees.go
Last active August 29, 2015 14:00
A Tour of Go - Exercise: Rot13 Reader
package main
import (
"code.google.com/p/go-tour/tree"
"fmt"
)
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int) {
@aseigneurin
aseigneurin / Vagrantfile
Created June 5, 2014 14:36
Vagrantfile: Ubuntu + 7zip
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "saucy-server-amd64"
@aseigneurin
aseigneurin / .bash_profile
Last active August 29, 2015 14:07
Bash profile
# Prompt
export PS1="\[\e[00;31;1m\]\t\[\e[0m\]\[\e[00;37m\] \[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
# Aliases
alias ls='ls -GFh'
alias ll='ls -l'
alias lla='ls -la'
@aseigneurin
aseigneurin / copy_remotely
Last active January 5, 2024 19:06
Ansible module to copy a file if the MD5 sum of the target is different
#!/usr/bin/python
DOCUMENTATION = '''
---
module: copy_remotely
short_description: Copies a file from the remote server to the remote server.
description:
- Copies a file but, unlike the M(file) module, the copy is performed on the
remote server.
The copy is only performed if the source and destination files are different
(different MD5 sums) or if the destination file does not exist.
@aseigneurin
aseigneurin / À copier sur la clé USB
Last active August 29, 2015 14:18
Devoxx - Spark-Cassandra
- la VM
- projet Home-Spotify-Exo
- repository Maven (.m2)
- mv ~/.m2 ~/.m2.bak
- mvn dependency:resolve
- mvn dependency:sources
- zip -r ~/m2repo.zip ~/.m2
Et éventuellement :
%dep
z.load("com.datastax.spark:spark-cassandra-connector_2.10:1.2.1")

Keybase proof

I hereby claim:

  • I am aseigneurin on github.
  • I am aseigneurin (https://keybase.io/aseigneurin) on keybase.
  • I have a public key whose fingerprint is AA8A 7411 B99A 63A9 F826 782B CD55 E09D 9B12 8033

To claim this, I am signing this object: