Skip to content

Instantly share code, notes, and snippets.

View pythoninthegrass's full-sized avatar

pythoninthegrass

View GitHub Profile
@pythoninthegrass
pythoninthegrass / 99-motd.sh
Last active September 22, 2024 00:47 — forked from arvati/alpine_motd_generator.md
Dynamic motd generator for Alpine Linux
#!/bin/sh
. /etc/os-release
PRETTY_NAME=`awk -F= '$1=="PRETTY_NAME" { print $2 ;}' /etc/os-release | tr -d '"'`
VERSION_ID=`awk -F= '$1=="VERSION_ID" { print $2 ;}' /etc/os-release`
UPTIME_DAYS=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 / 86400)
UPTIME_HOURS=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 % 86400 / 3600)
UPTIME_MINUTES=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 % 86400 % 3600 / 60)
cat > /etc/motd << EOF
@pythoninthegrass
pythoninthegrass / Dockerfile.deadsnakes
Last active July 11, 2024 18:59 — forked from BillRaymond/gist:b39ae5d862aa81a250b70b812bd5d1cc
Dockerfile to build a specific version of Python and set it as the default using Deadsnakes
# syntax=docker/dockerfile:1.7
FROM ubuntu:20.04
ARG PYTHON_VERSION="3.11"
ENV TZ=US/Chicago
ARG DEBIAN_FRONTEND=noninteractive
RUN <<EOF
#!/usr/bin/env bash
@pythoninthegrass
pythoninthegrass / resize_disk_image.md
Created April 6, 2024 06:01 — forked from joseluisq/resize_disk_image.md
How to resize a qcow2 disk image on Linux

How to resize a qcow2 disk image on Linux

This example takes olddisk.qcow2 and resizes it into newdisk.qcow2, extending one of the guest's partitions to fill the extra space.

1. qcow2 format

1.1. Verify the filesystems of olddisk.qcow2

@pythoninthegrass
pythoninthegrass / Dockerfile
Last active March 22, 2024 05:24 — forked from orenitamar/Dockerfile
Installing numpy, scipy, pandas and matplotlib in Alpine (Docker)
# Below are the dependencies required for installing the common combination of numpy, scipy, pandas and matplotlib
# in an Alpine based Docker image.
ARG VERSION=3.18
FROM alpine:${VERSION}
RUN apk update \
&& apk add \
--no-cache \
# Source: https://gist.github.com/vfarcic/77c63cede031951654d5fea5ce0acb43
#########################################################################################
# Say Goodbye to Makefile - Use Taskfile to Manage Tasks in CI/CD Pipelines and Locally #
#########################################################################################
# Additional Info:
# - Task: https://taskfile.dev
# - Dagger: The Missing Ingredient for Your Disastrous CI/CD Pipeline: https://youtu.be/oosQ3z_9UEM
@pythoninthegrass
pythoninthegrass / kamal.md
Last active October 7, 2024 10:41 — forked from huksley/mrsk.md
kamal - the missing manual

kamal

This documentation adds important additions to the docs for kamal deploy tool (see github.com/basecamp/kamal)

Destination flag

You can use kamal deploy --destination staging

This will read config/deploy.yml and config/deploy.staging.yml files, and also will read .env.staging file if it exists.

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