Skip to content

Instantly share code, notes, and snippets.

View pythoninthegrass's full-sized avatar

pythoninthegrass

View GitHub Profile
@pythoninthegrass
pythoninthegrass / data_drives.sh
Created November 22, 2023 19:39
Make filesystem then add drives to fstab
View data_drives.sh
# create dirs
mkdir -p /data/{0..2}
# mkfs xfs
mkfs.xfs /dev/nvme0n1
mkfs.xfs /dev/nvme1n1
mkfs.xfs /dev/nvme2n1
# mount partition manually (optional)
# mount /dev/nvme0n1 /data/0
@pythoninthegrass
pythoninthegrass / gen_passwd.sh
Last active November 21, 2023 17:58
Generate a hash from a random salt and password from stdinput.
View gen_passwd.sh
#!/usr/bin/env bash
# shellcheck disable=all
# pass a password to this script and it will return the hash
if [ -z "$1" ]; then
echo "Usage: $0 <password> <salt>"
exit 1
fi
@pythoninthegrass
pythoninthegrass / omnivore_export.py
Last active November 13, 2023 12:18
MVP for exporting 3000+ articles from Omnivore in one go via the GraphQL library.
View omnivore_export.py
#!/usr/bin/env python3
import json
from decouple import config
from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport
from gql.transport.exceptions import TransportServerError, TransportQueryError
api_key = config('OMNIVORE_API_KEY')
@pythoninthegrass
pythoninthegrass / run-ios-sim.sh
Last active November 16, 2023 21:17
Run iOS simulator from the command line.
View run-ios-sim.sh
#!/usr/bin/env bash
# shellcheck disable=SC2143,SC2317
# TODO: debug ctrl-d
# trap ctrl-c, ctrl-d, and ctrl-z
trap_card() {
echo -e "\nGoodbye!"; exit 0
}
trap trap_card SIGINT SIGQUIT SIGTSTP
@pythoninthegrass
pythoninthegrass / solution.py
Created October 28, 2023 00:57
Snyk Fetch the Flag: sparky
View solution.py
#!/usr/bin/env python3
import argparse
import base64
import datetime
import requests
from colorama import Fore
"""
SOURCE
@pythoninthegrass
pythoninthegrass / SOLUTION.md
Created October 27, 2023 19:53
Snyk Fetch the Flag: unhackableandy
View SOLUTION.md

Unhackable Andy

  • Navigate to mistaken git commit of .env file here
  • Log into docker instance of admin dashboard (e.g., http://challenge.ctf.games:30715/dashboard)
  • Enter creds
  • Find the flag and output contents instead of resetting the server
    find / -maxdepth 10 -iname "flag.txt" -exec cat {} \; 2>/dev/null
@pythoninthegrass
pythoninthegrass / m3uparser.py
Last active October 24, 2023 02:31
Reconcile Amazon Music (csv) + MP3 library (m3u) to recreate a local playlist(s) with matching library files.
View m3uparser.py
#!/usr/bin/env python3
# SOURCE: https://github.com/pythoninthegrass/m3u_prsr
import sys
class track():
def __init__(self, length, title, path):
self.length = length
@pythoninthegrass
pythoninthegrass / compile_python.sh
Last active October 14, 2023 22:28
Compile and install a specific version of Python from source
View compile_python.sh
#!/usr/bin/env bash
# shellcheck disable=SC2046,SC2086,SC2164
cat << 'DESCRIPTION' >/dev/null
compile_python.sh compiles and installs a specific version of Python from source.
USAGE
./compile_python.sh "<version>"
@pythoninthegrass
pythoninthegrass / README.md
Last active October 19, 2023 05:44
Decompress/compress all directories ineither a given or current directory.
View README.md

archive (all)

Usage

# clone
cd ~/Downloads
git clone https://gist.github.com/d76520b1bfa66713a5e27ead5e2c4e93.git archive

# create local bin directory
mkdir -p ~/.local/bin
@pythoninthegrass
pythoninthegrass / imperial_credit.py
Last active September 18, 2023 19:58
Convert Imperial Credits to US Dollars and vice versa
View imperial_credit.py
#!/usr/bin/env python3.11
import sys
"""
Convert Imperial Credits to US Dollars and vice versa.
Based on the exchange rate of 4.50 Imperial Credits to 1 US Dollar.
cf: