Skip to content

Instantly share code, notes, and snippets.

View obrassard's full-sized avatar

Olivier Brassard obrassard

View GitHub Profile
@obrassard
obrassard / bauhaus-pattern-svg-v1.markdown
Created August 12, 2022 00:35
Bauhaus Pattern SVG v1
@obrassard
obrassard / Cloudflare Tunnel Setup.md
Created February 26, 2022 03:40
This quick guide will help you set up a Cloudflare Tunnel on your Linux server

Cloudflare Tunnel Setup on Linux

This quick guide will help you set up a Cloudflare Tunnel on your Linux server !

Cloudflare Tunnel provides you with a secure way to connect your resources to the web without a publicly routable IP address. With Tunnel, you do not send traffic to an external IP, instead, a lightweight daemon in your infrastructure (cloudflared) creates outbound-only connections to Cloudflare’s edge. Cloudflare Tunnel can connect HTTP web servers, SSH servers, remote desktops, and other protocols safely to Cloudflare. This way, your origins can serve traffic through Cloudflare without being vulnerable to attacks that bypass Cloudflare. (Source)

Getting Started

Pre-requisites

version: '3'
services:
portainer:
image: portainer/portainer-ce # Pulled from Docker Hub
container_name: portainer
# restart: always
ports:
- 9000:9000
volumes:
- /var/run/docker.sock:/var/run/docker.sock
const fs = require('fs');
const https = require('https')
const options = {
hostname: 'api.github.com',
method: 'https',
port: 443,
method: 'GET',
path: '/repos/<owner>/<repo>/issues?state=all&per_page=100',
headers: {
@obrassard
obrassard / CaesarCypherDecoder.kt
Last active December 22, 2020 04:14
Kotlin implementation of a Caesar cypher decoder utility (See https://en.wikipedia.org/wiki/Caesar_cipher)
import kotlin.collections.HashMap
fun main() {
with(CaesarCypherDecoder()) {
val message = decode("QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD", 'K', 'H')
println("Decoded message : $message")
bruteForce("CZGGJ RJMGY DI V NZXMZODQZ HVIIZM")
}
}
package LOG320.labo3.helpers;
import java.util.Collections;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.TimeUnit;
/**
* Forked from https://gist.github.com/juanmf/4147a9b7010c7b04c003
*/
@obrassard
obrassard / ActionDelegate.ts
Last active November 3, 2020 22:18
This class, inspired by C# delegation system, allow dynamic mapping of several functions/methods inside a single "delegate" object which can later be invoked or passed as a function
type DelegateFunction = (...args: any[]) => void;
export class ActionDelegate {
private delegation: DelegateFunction[];
constructor() {
this.delegation = []
}
public add(f: DelegateFunction): ActionDelegate {
this.delegation.push(f);
@obrassard
obrassard / backup-s3-db.sh
Last active March 17, 2020 03:58
Simple script to backup a MySQL database to an S3 bucket
#!/bin/bash
db=$1
s3bucket=$2
filename=$db.$(date +%F.%H%M%S).sql.gz
filepath=~/backups/$filename
echo "Backuping MySQL Database $db ..."
mkdir -p ~/backups
/usr/bin/mysqldump -u root $db | gzip > $filepath
@obrassard
obrassard / xdebug-vagrant-vscode.md
Last active March 11, 2020 16:29 — forked from sveggiani/instructions.md
[Configure XDebug, Visual Studio Code for a Vagrant VM] #debug #vm #vscode

Configure XDebug, Visual Studio Code for a Vagrant VM

1. Assumptions

  • Project is served on /vagrant/craft in the Vagrant box
  • Guest machine IP is 10.0.2.2 (if this doesn't work, run route -nee in the VM and look for the gateway address)

2. Configuration

@obrassard
obrassard / portainer-dokku.md
Created January 23, 2020 01:34 — forked from woudsma/portainer-dokku.md
TLS secured TCP exposed Docker daemon on Dokku host - setup

TLS secured TCP exposed Docker daemon on Dokku host - setup

  1. Create certificates
  2. Edit Docker options
  3. Restart Docker
  4. Copy client certificates from host
  5. (optional) Add remote endpoint in Portainer

Tested on a standard $5/mo DigitalOcean VPS running Ubuntu 16.04.