Skip to content

Instantly share code, notes, and snippets.

Avatar

Antoine Aflalo Belphemur

View GitHub Profile
@Belphemur
Belphemur / DeepDotKey.ts
Last active Oct 30, 2020
Deep generate dot notation in TypeScript with example
View DeepDotKey.ts
interface Hello {
foo : World;
bar: Number;
array: World[]
}
interface World {
greeting: string;
}
@Belphemur
Belphemur / nginx-proxy.conf
Last active Dec 12, 2020 — forked from ivanionut/nginx-proxy.conf
Proxy nginx to use Google Tag Manager
View nginx-proxy.conf
# Google Analytics Bypassing Adblockers
## Client
change www.googletagmanager.com => your.domain.com
```
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://your.domain.com/gtag/js?id=UA-123456789-1"></script>
```
@Belphemur
Belphemur / .borg.conf
Created Jun 5, 2020
Borg Backup script
View .borg.conf
#!/bin/sh
REPOSITORY=_SERVER_:_PATH_
BORG_CMD="borg"
BACKUP_DIR="/"
BACKUP_OPTIONS="--compress zstd,8 -v"
BACKUP_PREFIX="ns2"
export BORG_PASSPHRASE="_PASS_PHRASE"
EXCLUDE="/proc /boot /dev /mnt /sys /tmp"
@Belphemur
Belphemur / wg-setup.sh
Created Aug 4, 2019
Wirguard with Network Namespace
View wg-setup.sh
#!/bin/sh
CONFIG=/etc/wireguard/wg1.conf
DEVICE=wg1
IP="10.11.1.115/16"
ip netns add vpn
ip link add $DEVICE type wireguard
wg setconf $DEVICE $CONFIG
ip link set $DEVICE netns vpn
@Belphemur
Belphemur / generate-client.sh
Last active Sep 27, 2020
Generate a new client configuration for WireGuard
View generate-client.sh
#!/usr/bin/env bash
if [ -z "$1" ]
then
echo "$0 client-name"
exit 1
fi
@Belphemur
Belphemur / release-git-dch.sh
Created Feb 28, 2018
Release script to use Debian Changelog and Git together to generate the new version
View release-git-dch.sh
#!/usr/bin/env bash
# TYPE= argument to the script where 0 = MAJOR, 1 = MINOR, 2 = BUILD. Default to BUILD.
GIT_VERSION=$(git describe --tags)
CURRENT_VERSION=$(echo ${GIT_VERSION:1} | cut -d'-' -f1)
TYPE=${1:-2}
function increment_version() {
local VERSION="$1"
local PLACE="$2"
@Belphemur
Belphemur / generate-certs.sh
Last active Nov 13, 2017
Generate Elastic Certificate (with CA if needed) for the full elastic stack. For Logstash use the .p8 key generated instead of the normal key.
View generate-certs.sh
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
FILE=${1:-instances.yml}
DAYS=${2:-36500}
BITS=${3-4096}
ES_VERSION=5.6.4
ES_DIR=/usr/share/elasticsearch/
CA_CERT=$DIR/certificates/ca/ca.crt
CA_KEY=$DIR/certificates/ca/ca.key
View keybase.md

Keybase proof

I hereby claim:

  • I am belphemur on github.
  • I am balor (https://keybase.io/balor) on keybase.
  • I have a public key ASAAofR_lNOYzKmOkgfa5ZtPCG-tLHrCUrvmTi4afHUVsQo

To claim this, I am signing this object:

@Belphemur
Belphemur / converter.php
Created Jun 14, 2017
Salesforce ID 15 chars to 18 chars converter PHP
View converter.php
<?php
function to18char(string $inputId) {
$suffix = '';
for ($i = 0; $i < 3; $i++) {
$flags = 0;
for ($j = 0; $j < 5; $j++) {
$start = $i * 5 + $j;
$end = ($i * 5 + $j + 1) - $start;
$c = substr($inputId, $start, $end);
if (ctype_upper($c) && $c >= 'A' && $c <= 'Z') {