Skip to content

Instantly share code, notes, and snippets.

View mathieu-aubin's full-sized avatar
💭
blop!

Mathieu Aubin mathieu-aubin

💭
blop!
  • Montreal, Quebec, Canada
View GitHub Profile
@mathieu-aubin
mathieu-aubin / digitalocean-proxy.sh
Created December 10, 2015 06:24 — forked from haf/LICENSE
Setting up a digitalocean proxy
#!/usr/bin/env bash
# How to start:
# 1. Sign up for DigitalOcean with this link https://www.digitalocean.com/?refcode=7bf219507e61
# -- it will be filled with $10 to start out (if you use the above link)
# 2. Go to https://cloud.digitalocean.com/settings/applications and find you API key
# 3. In your shell, run 'export DIGITALOCEAN_TOKEN="INSERT TOKEN HERE"', without the outer quotes.
# 4. `brew install jq`
# 5. `./digitalocean-proxy`
# 6. When you are done, press CTRL+C ONCE, and everything will be cleaned up.
@mathieu-aubin
mathieu-aubin / svg.bash
Created January 22, 2016 00:48 — forked from peteboere/svg.bash
Utilities for working with svgs
#
# Utilities for working with svgs
#
# svg2png - Create png file from source svg using inkscape
# svg2pngr - Create png file from source svg using inkscape recursively
# svgz - Create svgz file from source svg
# svgzr - Create svgz file from source svg recursively
#
@mathieu-aubin
mathieu-aubin / php-showSource.php
Created January 25, 2016 08:17
PHP - Show file source from url query
<?php
# Including this conditional code to the top of a script allows to display it's content
# (sourcecode), highlighted, adding query string "?showSource" to the file request.
# ex: http://example.com/scriptname.php?showSource
# fully modifiable, __FILE__ can be another local file, query can be changed....
if ($_SERVER['REQUEST_METHOD'] != 'POST' && isset($_GET['showSource'])) {
highlight_file(__FILE__);
die();
}
// start of script code
@mathieu-aubin
mathieu-aubin / bare_bones_curl_client.php
Last active February 13, 2016 04:20
Bare Bones PHP cURL Client for API Consumption
<?php
// Author: https://gitlab.com/u/jordanbsanders
// Taken from https://gitlab.com/snippets/14460
// Will want to determine protocol and domain dynamically.
$api_endpoint = 'http://my.domain.com/api/endpoint';
$post_data = array(
'username' => urlencode('fake_username'),
'password' => urlencode('fake_password')
);
@mathieu-aubin
mathieu-aubin / tinyUrl.php
Created February 13, 2016 04:40
tinyurl.com API
<?php
function tinyUrl($url) {
$handle = curl_init();
$timeout = 5;
curl_setopt($handle,CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$url);
curl_setopt($handle,CURLOPT_RETURNTRANSFER,1);
curl_setopt($handle,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($handle);
curl_close($handle);
@mathieu-aubin
mathieu-aubin / ytdID.min.js
Last active March 11, 2016 21:34 — forked from takien/youtubeID.js
Get YouTube ID from various YouTube URL using JavaScript
// src: takien (http://takien.com) mods: Mathieu Aubin (mathieu@zeroserieux.com)
function ytdID(url){var ID='';url = url.replace(/(>|<)/gi,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);if(url[2]!==undefined){ID = url[2].split(/[^0-9a-z_\-]/i);ID = ID[0];}else {ID = url;}return ID;}
@mathieu-aubin
mathieu-aubin / wp.sh
Created March 19, 2016 20:55 — forked from phlbnks/wp.sh
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Do you need to setup new MySQL database? (y/n)"
read -e setupmysql
if [ "$setupmysql" == y ] ; then
echo "MySQL Admin User: "
read -e mysqluser

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
@mathieu-aubin
mathieu-aubin / colors_and_formatting.sh
Created June 13, 2016 22:05
The following shell script displays a lot of possible combination of the attributes (but not all, because it uses only one formatting attribute at a time).
#!/bin/bash
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
#Background
for clbg in {40..47} {100..107} 49 ; do
@mathieu-aubin
mathieu-aubin / 256-colors.sh
Last active July 22, 2016 19:24
The following script display the 256 colors available on some terminals and terminals emulators like XTerm and GNOME Terminal.
#!/bin/bash
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
for fgbg in 38 48 ; do #Foreground/Background
for color in {0..256} ; do #Colors