Skip to content

Instantly share code, notes, and snippets.

View Embraser01's full-sized avatar

Marc-Antoine Embraser01

  • Bourg en Bresse - France
  • 19:37 (UTC +02:00)
View GitHub Profile
@Embraser01
Embraser01 / gen-docker-config.js
Created May 12, 2020 10:56
Simple node script used to generate a k8s compatible docker `config.json`
/**
* This script will create a base64 string that will be used by K8S to pull
* images from the Docker Registry.
*
* More info here: https://kubernetes.io/fr/docs/tasks/configure-pod-container/pull-image-private-registry/
*/
const encodeToBase64 = (str) => Buffer.from(str).toString('base64');
const createFinalString = (obj) => encodeToBase64(JSON.stringify(obj));
@Embraser01
Embraser01 / gifts.js
Created November 25, 2018 13:49
Generate directed pairs for christmas gifts
const PEOPLE = [
{ name: 'John Doe', email: 'johndoe@gmail.com' },
{ name: 'Lea' },
{ name: 'Bob' },
];
/**
* Return a new list shuffled.
*
* @param originalList {Array<Object>}
@Embraser01
Embraser01 / ChangePasswordPostfixAdminDriver.php
Created September 3, 2018 10:10
Rainloop Plugin - Postfix change password fix
<?php
class ChangePasswordPostfixAdminDriver implements \RainLoop\Providers\ChangePassword\ChangePasswordInterface
{
/**
* @var string
*/
private $sEngine = 'MySQL';
/**
@Embraser01
Embraser01 / INSA_Login.sh
Last active September 20, 2018 07:54
Script to log at INSA Lyon
#!/bin/bash
# Get the redirect URL
# Because INSA have done some stupid configuration,
# You must use a non existing DNS in order to get it working
TEST_URL='http://insa.fr/'
NEW_LOCATION_URL=$(curl -Ls -o /dev/null -w %{url_effective} ${TEST_URL})
HOSTNAME=$(echo ${NEW_LOCATION_URL} | awk -F/ '{print $3}')
@Embraser01
Embraser01 / main.js
Created June 13, 2017 13:34
Find best couples
let request = require('request');
const MORE_OR_LESS = 1;
const NB_DAYS = 2;
function addIfNotExist(participantsAvailable, participants, iDate) {
for (let i = 0; i < participants.length; i++) {
if (participants[i].preferences[iDate] > 0
&& participantsAvailable.indexOf(participants[i]) === -1
@Embraser01
Embraser01 / Makefile
Created May 10, 2017 13:52
TP6 - SE - INSA Lyon
main: main.c bag.c bag.h
gcc -O3 -pthread -Wall bag.c main.c -o $@
clean:
rm -f main