Skip to content

Instantly share code, notes, and snippets.

@rz3n
rz3n / cfmail.py
Last active June 3, 2024 16:36
Script to manage Cloudflare Email Routing rules using the Cloudflare API. Allows to add, list and delete rules. It was created to have an easy way to manage email aliases
#!/usr/bin/env python3
# Simple python script to manage my Cloudflare Email routes via API
# API Documentation: https://developers.cloudflare.com/api/operations/email-routing-routing-rules-list-routing-rules
import requests
import sys
CF_API_TOKEN = "YOUR_CF_API_TOKEN"
CF_ACCOUNT_ID = "YOUR_CF_ACCOUNT_ID"
@rz3n
rz3n / install.ignore.yaml
Last active May 14, 2024 16:28
Dotfiles bootstrap script in Python
---
ignore:
- .git
- .gitignore
- README.md
- install
- install.ignore.yaml
@rz3n
rz3n / update-chromium.sh
Created February 14, 2022 04:55
Bash script to update Chromium browser on Mac
#!/usr/bin/env bash
# basic chromium update script for macos
URL="https://download-chromium.appspot.com/dl/Mac?type=snapshots"
TMP="/tmp/chromium"
FILENAME="chromium.zip"
APPDIR="/Applications/"
# remporary dir
mkdir $TMP
@rz3n
rz3n / update-chromium.ps1
Created November 15, 2021 16:47
Powershell script to update Chromium
$CHROMIUM_URI = "https://download-chromium.appspot.com/dl/Win_x64?type=snapshots"
$LOCALAPPDATA = Get-content -Path Env:LOCALAPPDATA
$LOCALPROGRAMS = $LOCALAPPDATA+"\Programs"
$TEMP = Get-content -Path Env:Temp
(new-object System.Net.WebClient).DownloadFile($CHROMIUM_URI,"$TEMP\chromium.zip")
7z x $TEMP\chromium.zip -aoa -o"$LOCALPROGRAMS" -r -y
rm $TEMP\chromium.zip
@rz3n
rz3n / Fortigate remote backup
Last active August 24, 2021 20:08
Remote backup for Fortigate using SSH
Simple python script for remotely backup Fortigates using SSH.
The public key must be previously configured in your fortigate.
```
config system admin
edit admin
set ssh-public-key1 "ssh-rsa your-key"
end
end
```
@rz3n
rz3n / myip.js
Last active April 13, 2021 17:41
Cloudflare Workers
/**
* Return your IPv4 or IPv6 address
*/
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
/**
* Respond to the request
@rz3n
rz3n / basic-zshrc
Last active July 8, 2020 16:47
p10k
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
export TERM="xterm-256color"
ZSH_THEME="powerlevel10k/powerlevel10k"
POWERLEVEL9K_MODE="nerdfont-complete"
DISABLE_UNTRACKED_FILES_DIRTY="true"
@rz3n
rz3n / docker-cleanup-resources.md
Created May 10, 2018 20:40 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm