Skip to content

Instantly share code, notes, and snippets.

View mikamboo's full-sized avatar
🏠
Working from home

Michaël P.O. mikamboo

🏠
Working from home
View GitHub Profile
@mikamboo
mikamboo / gist:8772514
Last active August 29, 2015 13:55
JodaTime PeriodFormatter sample
long mills = 15000000;
Seconds time = Seconds.seconds((int) (mills/1000));
Period period = new Period(time);
PeriodFormatter dhm = new PeriodFormatterBuilder()
.appendDays()
.appendSuffix(" ")
.appendSuffix(getString(R.string.suffix_label_day), getString(R.string.suffix_label_days))
.appendSeparator(" ")
@mikamboo
mikamboo / Alogorithms.java
Created February 14, 2014 22:59
Fisher-Yates shuffle alogo
/**
* Implementing Fisher–Yates shuffle
*/
static void shuffleArray(int[] ar)
{
Random rnd = new Random();
for (int i = ar.length - 1; i > 0; i--)
{
int index = rnd.nextInt(i + 1);
//-- Simple swap
@mikamboo
mikamboo / gist:9321803
Created March 3, 2014 09:59
JAVA : JodaTime Lib PeriodFormatter usage sample
package labs.mikangali;
import org.joda.time.PeriodType;
import org.joda.time.Seconds;
import org.joda.time.format.PeriodFormatter;
import org.joda.time.format.PeriodFormatterBuilder;
public class Main {
public static void main(String[] args) {
@mikamboo
mikamboo / gist:9386460
Last active August 29, 2015 13:57
PHP Postgres sous Linux : Script exécutable en shell, utilitaire de manipulation d'un base pgsql en php.
#!/usr/bin/php521/php -q
<?php
/**
* ---------------------------------------------------------------------------------------------------------------------
* SCRIPT PURGE DES TABLES LOGS
*
* @param String -a : Application
* @param int -l : Limite nom d'élément à suppimer à chaque execution (perfs)
* @param int -n : Nombre de jours de traces à conserver
@mikamboo
mikamboo / gist:9408242
Last active August 29, 2015 13:57
PHP : Create .csv file from array
<?php
$arr_data = array(
"Nom" => "Doe",
"Prenom" => "John",
"Twitter" => "@mikamboo",
"Entity" => "Mikngali"
"url" => "http://mikangali.com"
);
@mikamboo
mikamboo / IntelliJ Shortcuts.md
Created July 12, 2014 09:38
Raccourcis utiles

Refreactor

MAJ + F6

Find usages

ALT + F7

Delete line

@mikamboo
mikamboo / bst.js
Last active August 29, 2015 14:12 — forked from trevmex/bst.js
/*
* File: bst.js
*
* A pure JavaScript implementation of a binary search tree.
*
*/
/*
* Class: BST
*
@mikamboo
mikamboo / create_vagrant_base_box.md
Last active August 29, 2015 14:14
Creating a base box in Vagrant

Creating a base box in Vagrant

This tutorial is for creating a vagrant box for ubuntu 12.04 (LTS)

Along the tutorial you must follow this conventions

  • Hostname: vagrant-[os-name], e.g. vagrant-debian-lenny
  • Domain: vagrantup.com (causes delays in resolving own FQDN, as in dnsdomainname or hostname --fqdn commands)
  • Root Password: vagrant
  • Main account login: vagrant
@mikamboo
mikamboo / ssh_keys_athentication.md
Last active August 29, 2015 14:16
Setting SSH key authentication

Linux setup a SSH key authentication

Voici la procédure : d'abord - et si ce n'est déjà fait - il vous faut installer le client openSSH :

Source

$ sudo apt-get update
$ sudo apt-get install openssh-client
@mikamboo
mikamboo / boot2Docker.md
Last active August 29, 2015 14:16
Docker tips

How to configure Docker when behind a proxy

Linux host

CAUTION : If you are in Linux environement (no boot2Docker) use directly Docker http-proxy

This example overrides the default docker.service file.

$ mkdir /etc/systemd/system/docker.service.d