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/bash | |
# https://stackoverflow.com/questions/66834864/how-to-determine-when-docker-containers-on-an-m1-macbook-are-running-via-qemu | |
#for i in `docker ps --format "{{.Image}}"` ; do | |
# docker image inspect $i --format "$i -> {{.Architecture}} : {{.Os}}" | |
#done | |
OPT=$@ | |
set -euo pipefail | |
docker container ls $OPT --format "{{.ID}}\t{{.Image}}\t{{.Command}}\t{{.Status}}\t{{.Names}}" | |
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 | |
# Based on https://stackoverflow.com/a/65920577/297793 | |
# Manually start this first: | |
## docker run -d \ | |
## --name gitlab-runner \ | |
## --restart always \ | |
## -v "$HOME:$HOME" \ | |
## -v /var/run/docker.sock:/var/run/docker.sock \ | |
## gitlab/gitlab-runner:latest |
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
cmake_minimum_required(VERSION 3.16) | |
project(luac C) | |
set(CMAKE_C_STANDARD 11) | |
find_package(PkgConfig REQUIRED) | |
pkg_search_module(LUA REQUIRED IMPORTED_TARGET luajit luajit2) | |
add_executable(retval retval.c) | |
target_link_libraries(retval PUBLIC PkgConfig::LUA) |
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 | |
""" | |
kubelog is a tool that lists all pods and their contains using fzf | |
and prints the logs for the selected one. | |
Options to get fzf: | |
- https://github.com/junegunn/fzf | |
- brew install fzf | |
""" |
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/bash | |
# Script to visually select a recent git branch to switch to | |
# Requires https://github.com/junegunn/fzf (brew install fzf) | |
branches () { | |
git for-each-ref --sort=-committerdate refs/heads/ | sed 's|.*refs/heads/||' | head -30 | |
} | |
branch=$(branches | fzf --no-sort --layout=reverse) |
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 bash | |
# When called with a name, open a specific note. | |
# When called without a name, use fzf to interactively search notes. | |
# (fzf: https://github.com/junegunn/fzf) | |
set -e | |
cd ~/path/to/my/notes/ | |
export EDITOR=nvim |
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 | |
# NOTE: btrfs quota must be enabled for this to work: | |
# btrfs quota enable /btrfs/ | |
import os | |
import sys | |
usage = {} | |
for line in os.popen('btrfs qgroup show / --raw', 'r'): | |
# 0/10784 15678980096 557056 | |
if not line.startswith('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
#!/bin/bash | |
raw_prefix="$1" | |
prefix_width=${PREFIX_WIDTH:-20} | |
color=color_${PREFIX_COLOR:-green} | |
error_color=color_${PREFIX_ERROR_COLOR:-red} | |
shift 1 | |
if [ "$raw_prefix" = "" ]; then | |
echo "USAGE: $0 <prefix> <command> [args..]" |
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
version: '2' | |
services: | |
php: | |
image: php:5.6-fpm-alpine | |
volumes: | |
- data:/_data | |
- ./site:/var/www/html:ro | |
networks: | |
- backend | |
command: sh -c 'chown www-data /_data && exec php-fpm' |
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
# Workaround for: https://github.com/feincms/feincms/issues/323 | |
# "Unable to delete pages containing custom content types" | |
from django.db.models.signals import pre_delete | |
import logging | |
log = logging.getLogger(__name__) | |
def fix_content_model_delete(model): | |
"""Register a pre-delete handler that will remove all content when a |
NewerOlder