Skip to content

Instantly share code, notes, and snippets.

View maoueh's full-sized avatar

Matthieu Vachon maoueh

View GitHub Profile
@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 December 20, 2023 01:04
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
- script@1.1.3:
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
@maoueh
maoueh / chef-stacktrace.out
Last active August 29, 2015 14:08
Resource execute rights problem (cat /var/chef/cache/chef-stacktrace.out)
Generated at 2014-11-03 10:19:02 -0500
Mixlib::ShellOut::ShellCommandFailed: execute[user1 reads file with owner user2 and group user2 with mode 0440] ((chef-apply cookbook)::(chef-apply recipe) line 25) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of cat /tmp/testfile ----
STDOUT:
STDERR: cat: /tmp/testfile: Permission denied
---- End output of cat /tmp/testfile ----
Ran cat /tmp/testfile returned 1
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.6.0/lib/mixlib/shellout.rb:272:in `invalid!'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.6.0/lib/mixlib/shellout.rb:259:in `error!'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/mixin/shell_out.rb:43:in `shell_out!'