Skip to content

Instantly share code, notes, and snippets.

Avatar

Antoine Aflalo Belphemur

View GitHub Profile
@Belphemur
Belphemur / DefaultKeyBinding.dict
Created Sep 2, 2022
DefaultKeyBinding.dict for MacOS to work like windows for Home/End and CTRL+Arrow functions
View DefaultKeyBinding.dict
//source: https://damieng.com/blog/2015/04/24/make-home-end-keys-behave-like-windows-on-mac-os-x/
//Move DefaultKeyBinding.dict in your ~/Library/KeyBindings folder
//Log out log back in
{
"\UF729" = moveToBeginningOfParagraph:; // home
"\UF72B" = moveToEndOfParagraph:; // end
"$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
"$\UF72B" = moveToEndOfParagraphAndModifySelection:; // shift-end
"^\UF729" = moveToBeginningOfDocument:; // ctrl-home
"^\UF72B" = moveToEndOfDocument:; // ctrl-end
@Belphemur
Belphemur / http-wordpress-login-xmlrpc.yaml
Last active Nov 11, 2021
CrowdSec - Wordpress Login & XML RPC Scenario
View http-wordpress-login-xmlrpc.yaml
type: leaky
format: 2.0
#debug: true
name: belphemur/http-wordpress-login-xmlrpc
description: "Detect attempt to access to wp-login and xmlrpc"
filter: "evt.Meta.log_type == 'http_access-log' && (evt.Parsed.file_name == 'wp-login.php' || evt.Parsed.file_name == 'xmlrpc.php') && evt.Parsed.verb == 'POST'"
groupby: "evt.Meta.source_ip"
#distinct: evt.Parsed.request
capacity: 4
leakspeed: 2m
@Belphemur
Belphemur / sandbox-winget.ps1
Last active Nov 25, 2022
Use Windows Sandboxing to be able to install your WinGet manifest. Source: https://megamorf.gitlab.io/2020/07/19/automating-the-windows-sandbox/
View sandbox-winget.ps1
# Parse Arguments
Param(
[Parameter(Mandatory, HelpMessage = "The path for the Manifest.")]
[String] $Manifest
)
if (-not (Test-Path -Path $Manifest -PathType Leaf)) {
throw 'The Manifest file does not exist.'
}
View 10-nextdns-catchall.sh
#!/bin/sh
SERVICE_FILE=nextdns-catchall.service
SOURCE_FILE_PATH=/data/${SERVICE_FILE}
SYSTEMD_FILE_PATH=/etc/systemd/system/${SERVICE_FILE}
if [ ! -f $SOURCE_FILE_PATH ];
then
echo "Can't find service file"
exit 1
fi
@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 Mar 6, 2021 — 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 Oct 20, 2021
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"