Skip to content

Instantly share code, notes, and snippets.

View csanquer's full-sized avatar

Charles Sanquer csanquer

View GitHub Profile
@csanquer
csanquer / format_bytes.php
Created November 20, 2014 15:38
Format bytes to best unit
<?php
/**
* @param int $bytes
* @param int $precision
* @param int $baseUnit 1024 or 1000
* @return array
*/
function formatBytes($bytes, $precision = 2, $baseUnit = 1024)
{
$unit = ['B','KB','MB','GB','TB','PB','EB'];
@csanquer
csanquer / .editorconfig
Last active October 24, 2016 08:47
Sample editorconfig file
# config for Text Editor and IDE
# http://editorconfig.org/
# This file must be commited at projet's root
root = true
# Common settings for all files
[*]
indent_style = space
indent_size = 4
@csanquer
csanquer / setup_nodejs.sh
Created November 7, 2016 13:55
Install nodejs ubuntu/debian
#!/bin/bash
# VERSION=node_7.x
# VERSION=node_6.x
# VERSION=node_5.x
# VERSION=node_4.x
# VERSION=node_0.12
VERSION=node_0.10
DISTRO="$(lsb_release -s -c)"
echo "deb https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee /etc/apt/sources.list.d/nodesource.list
@csanquer
csanquer / playbook.sh
Created November 8, 2016 11:37
Ansible vault and playbook bash script wrapper
#!/bin/bash
# vault password file to create
vaultPasswordFile=vault_password
#########################################
### Bash script location ###
#########################################
realpath() {

Keybase proof

I hereby claim:

  • I am csanquer on github.
  • I am csanquer (https://keybase.io/csanquer) on keybase.
  • I have a public key ASA-u6DIilO-5y8ubnplPYik6ndvlT6MP9wxACLLe2ozjAo

To claim this, I am signing this object: