Skip to content

Instantly share code, notes, and snippets.

Tom Rochette tomzx

Block or report user

Report or block tomzx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
import os
import re
from argparse import ArgumentParser
argument_parser = ArgumentParser()
args = argument_parser.parse_args()
tomzx / CreateMissingForeignKeyMigration.php
Created May 2, 2018
View CreateMissingForeignKeyMigration.php
namespace App\Console\Commands;
use Doctrine\Common\Inflector\Inflector;
use Doctrine\DBAL\Types\IntegerType;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class CreateMissingForeignKeyMigration extends Command
View colors.php
class Colors {
private $foreground_colors = array();
private $background_colors = array();
public function __construct() {
// Set up shell colors
$this->foreground_colors['black'] = '0;30';
$this->foreground_colors['dark_gray'] = '1;30';
tomzx /
Created Dec 4, 2016 — forked from keo/
Setup encrypted partition for Docker containers
# Setup encrypted disk image
# For Ubuntu 14.04 LTS
apt-get update
apt-get -y upgrade
apt-get -y install cryptsetup
View gkm.js
'use strict';
// TODO: Verify if we're getting loaded from multiples location and prevent creating new child processes?
var EventEmitter2 = require('eventemitter2').EventEmitter2;
var path = require('path');
var spawn = require('child_process').spawn;
var events = new EventEmitter2({wildcard: true});
var javaPath = '';
View xmlToArray.php
function xmlToArray($xml, $options = array()) {
$defaults = array(
'namespaceSeparator' => ':',//you may want this to be something other than a colon
'attributePrefix' => '@', //to distinguish between attributes and nodes with the same name
'alwaysArray' => array(), //array of xml tag names which should always become arrays
'autoArray' => true, //only create arrays for tags which appear more than once
'textContent' => '$', //key used for the text content of elements
'autoText' => true, //skip textContent key if node has no attributes or child nodes
tomzx / xml2js.php
Created Feb 15, 2016
PHP xml2js (attributes to $, nodeValue to _)
View xml2js.php
function xml2js($xmlnode)
$root = func_num_args() <= 1;
$jsnode = [];
if ($root) {
$nodename = $xmlnode->getName();
$jsnode[$nodename] = xml2js($xmlnode, true);
tomzx / measure.php
Last active Jan 21, 2016
Shorten melody-like script to install composer packages for a script
View measure.php
$packages = [
// Your packages here
'tomzx/file-tracker: ~0.1@dev',
$commands = [
['require', 'packages' => $packages, '--no-update' => true],
tomzx / melody-bootstrapper.php
Last active Jan 21, 2016
Melody bootstrapper
View melody-bootstrapper.php
- "your/dependencies: 1.0"
if ( ! file_exists('composer.phar')) {
file_put_contents('composer.phar', fopen('', 'r'));
View gh,js
Statistical profiling result from null, (1219 ticks, 0 unaccounted, 0 excluded).
[Shared libraries]:
ticks total nonlib name
834 68.4% /lib/x86_64-linux-gnu/
268 22.0% /usr/local/bin/node
96 7.9% [vdso]
18 1.5% /lib/x86_64-linux-gnu/
1 0.1% /lib/x86_64-linux-gnu/
You can’t perform that action at this time.