This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Source: https://gist.github.com/iTrooz/4caeaf2f26c5d4a1ee06f33917cd6fa7 | |
# Syntax: loadenv <command> [args] | |
if [ -f .env ] | |
then | |
while IFS= read -r line || [ -n "$line" ]; do | |
var="${line%%#*}" | |
[[ -n "$var" ]] && eval "export $var" # Eval is needed for quoted values | |
done < .env |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// wdym structs and classes have different assignment semantics, and it still persists with protocols ?? | |
protocol P { | |
var data: Int { get set } | |
} | |
struct A: P { | |
var data = 0 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Generation] | |
[Generation.Dragon] | |
#Whether to generate dragon skeletons or not | |
"Generate Dragon Skeletons" = true | |
#1 out of this number chance per chunk for generation | |
#Range: 1 ~ 10000 | |
"Generate Dragon Skeleton Chance" = 300 | |
#1 out of this number chance per chunk for generation | |
#Range: 1 ~ 10000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
output = os.popen('git shortlog -s -n').read() | |
lines = {} | |
for line in output.split("\n"): | |
if not line: | |
continue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Allows you to always use Ctrl+C on a command | |
2 Ctrl+C = SIGTERM | |
3 Ctrl+C = SIGKILL | |
""" | |
import signal | |
import sys | |
import datetime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Auto run command (syntax is `gdbcmd <binary> <args>`) | |
# Auto exit if the program exits with 0 | |
gdb "$1" \ | |
-ex 'python gdb.events.exited.connect(lambda x : gdb.execute("quit") if x.exit_code == 0 else None)' \ | |
-ex "run ${*:2}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
list explicitly installed packages that are are depended on by other softwares | |
""" | |
import subprocess | |
def parse_pacman_output(data: str): | |
packages = {} | |
current_package = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"annotations": { | |
"list": [ | |
{ | |
"builtIn": 1, | |
"datasource": { | |
"type": "datasource", | |
"uid": "grafana" | |
}, | |
"enable": true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Show the swap usage of all processes in the system. | |
Note: This may not be reliable because of "shared pages". Source: https://www.cyberciti.biz/faq/linux-which-process-is-using-swap/ | |
""" | |
import os | |
import sys | |
import humanize | |
import psutil | |
import tabulate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
This script setups the UDP translators in order to enable UDP traffic forwarding over SSH. | |
-L example usage: `py ssh_udp.py -L 53000:8.8.8.8:53 your_ssh_host` an then `dig @127.0.0.1 -p 53000 google.com` locally | |
-R example usage: `py ssh_udp.py -R 53000:8.8.8.8:53 your_ssh_host` an then `dig @127.0.0.1 -p 53000 google.com` on the server | |
Note: I know this code is ugly. | |
Thanks to https://stackpointer.io/network/ssh-port-forwarding-tcp-udp/365/ for the help | |
""" | |
import subprocess | |
import time |
NewerOlder