Skip to content

Instantly share code, notes, and snippets.

View maoueh's full-sized avatar

Matthieu Vachon maoueh

View GitHub Profile
@maoueh
maoueh / index.js
Last active August 29, 2019 07:38
A quick script to play with Promise nesting and resolution (node index.js)
function buildPromise(tag, shouldError) {
if (shouldError) {
return new Promise((resolve, reject) => {
console.log(tag + " executor")
setTimeout(() => { console.log(tag + " rejecting!"); reject(tag + " failed on purpose") }, 250)
})
}
return new Promise((resolve, reject) => {
console.log(tag + " executor")
@maoueh
maoueh / shellscript.json
Last active June 21, 2019 14:53
VS Code Shellscript Snippets for a Bash Boilerplate script (developer script)
{
"Bash script boilerplate": {
"prefix": "bshb",
"body": [
"#!/usr/bin/env bash",
"",
"ROOT=\"$( cd \"$( dirname \"\\${BASH_SOURCE[0]\\}\" )\" && pwd )\"",
"",
"main() {",
" current_dir=\"`pwd`\"",
@maoueh
maoueh / main.go
Last active September 8, 2024 17:50
golang gorilla mux sub/router + specific middleware per subrouter
package main
import (
"time"
"fmt"
"net/http"
"github.com/gorilla/mux"
)
func main() {
##
# From shell command line, with a MySQL database dump of the videos database, this
# shell command line will print all the duplicates duplicate string.
#
# Replace the `<...>` string by actual values for your system. Also, I use
# hard-coded IP in my database which result in the used Regex
# (`"'smb://.+?/.+?\.([a-zA-Z0-9]+)'"`). It's general enough but you might need
# to update it to your needs.
#
# OS: Mac OS X (10.11.6)
docker_test:
steps:
- git::https://github.com/samsao/bitrise-step-macos-install-docker.git@feature/auto-export:
title: Install Docker
- [email protected]:
title: Build image
inputs:
- content: |-
#!/bin/bash
set -ex
@maoueh
maoueh / Uris.java
Created August 24, 2016 17:28
Simple Uris Java helper
import java.net.URI;
import java.net.URISyntaxException;
/**
* Unlicense granted <http://unlicense.org>
*/
public final class Uris {
/**
* An unchecked version of the {@link URI#URI(String)} construction, i.e. a version that does not throw {@link
@maoueh
maoueh / test-cloud-init-run.sh
Created June 2, 2016 14:28
Small script to test changes made to cloud init config without rebooting
rm -rf /var/lib/cloud/instance && rm -rf /var/lib/cloud/instances/* && rm -rf /var/lib/cloud/sem/*
cloud-init init && cloud-init modules --mode config && cloud-init modules --mode final
@maoueh
maoueh / cookbooks_app_recipes_default.rb
Last active December 9, 2015 16:36
Chef bug custom resources and include_recipe
# cookbooks/app/recipes/default.rb
include_recipe 'common::default'
@maoueh
maoueh / msys2_cross_compiler_for_rpi.md
Last active January 16, 2022 17:49
Build steps to create a (cross-)compiler creating native code executable targeting raspberry pi (RPi), running on MSYS2 and using MSYS2 to compile the cross-compiler

Build Steps

This document details extra that were needed to build the rpi cross-compiler on MSYS2. The original instructions are located on gurucodings.

This cross-compiler has been created targeting the Raspbian Wheezy OS which is based on Debian Wheezy with special support for the Raspberry PI architecture. The version that was installed on my rpi is 2014-06-20-wheezy-raspbian.

Here the version of the various tools currently present in this version of Raspbian (Guest OS):

  • gcc (Debian 4.6.3-14+rpi1) 4.6.3
  • GNU ld (GNU Binutils for Debian) 2.22
@maoueh
maoueh / stunnel
Last active July 29, 2022 20:37
Service definition for stunnel (Tested on CentOS 6.5)
#!/bin/bash
#
# Script to run stunnel in daemon mode at boot time.
#
# Check http://www.gaztronics.net/ for the
# most up-to-date version of this script.
#
# This script is realeased under the terms of the GPL.
# You can source a copy at:
# http://www.fsf.org/copyleft/copyleft.html