Skip to content

Instantly share code, notes, and snippets.

View pythoninthegrass's full-sized avatar

pythoninthegrass

View GitHub Profile

microk8s & fluxcd

(optional) prepare the server

# install at https://multipass.run/
multipass launch --name microk8s-flux --mem 2G
multipass shell microk8s-flux

# assume ubuntu with snap installed, if not install it via
apt install snapd
@pythoninthegrass
pythoninthegrass / ghcr.md
Created December 28, 2023 18:41 — forked from yokawasa/ghcr.md
ghcr (GitHub Container Registry)

ghcr (GitHub Container Registry) quickstart

CLI

To push container images to ghcr, you need peronal access token (PAT) - see how to create PAT

  1. Get PAT (personal access token)

Personal Settings > Developer settings > Personal access tokens

@pythoninthegrass
pythoninthegrass / font.yml
Last active September 15, 2023 03:43 — forked from mkubenka/sparsecheckout.yml
Install hack nerd-font via ansible shell out to git sparse-checkout
# code: language=ansible
---
- hosts: localhost
connection: local
gather_facts: true
any_errors_fatal: true
vars:
base_dir: "{{ home_dir }}/git/nerd-fonts"
repo_url: https://github.com/ryanoasis/nerd-fonts.git
@pythoninthegrass
pythoninthegrass / launch-GRD.sh
Created July 30, 2023 19:32 — forked from greyltc/launch-GRD.sh
configures then activates gnome-remote-desktop from the command line
#!/usr/bin/env bash
# run this on the remote terminal machine, as auser with sudo powers, probably through a remote ssh shell
# this will overwrite all the settings it touches
# the name of the user to run these commands as
TARGET_USER=jane
# we need an inlocked desktop session. we can either start a new autologin one or unlock an existing one
@pythoninthegrass
pythoninthegrass / swap_off.sh
Last active June 26, 2023 17:06 — forked from anildigital/cleanup_swap.md
Cleanup swap space on macOS
#!/usr/bin/env bash
# To see current swap usage
sysctl -a | grep swap
# Monitor swap usage
vm_stat 60
# Use only when when your system is in a very bad shape
sudo pkill -HUP -u _windowserver
@pythoninthegrass
pythoninthegrass / Diablo II.ahk
Created June 13, 2023 22:03 — forked from fabd/Diablo II.ahk
A script I use to center the game window and play at exactly 2x the original resolution to avoid stretching and blurry image.
; Diablo II LoD
;
; Instructions:
;
; 1) Start the game in windowed mode (eg. "-sndbkg -skiptobnet -w" options in shortcut).
;
; 2) Press Ctrl Alt f , Ctrl Alt h to set game to 1600x1200 centered on the desktop.
;
;
; Ctrl Alt f Toggle active window title bar.

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 / README.md
Last active February 28, 2023 21:13 — forked from nordineb/readme.MD
multipass + qemu on macOS

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

OpenSSL 🔐

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@pythoninthegrass
pythoninthegrass / convert.py
Last active November 6, 2022 18:39 — forked from aolle/convert.py
Convert Nimbus Notes HTML to Markdown for UpNote
#!/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