Skip to content

Instantly share code, notes, and snippets.

@NickHollow
NickHollow / build.sh
Created February 24, 2021 19:57 — forked from dragon788/build.sh
Ubuntu ISO with preseed.cfg generation script
#!/bin/bash
## FORSTWOOF UBUNTU PRESEED :: BUILD SCRIPT
# Quit on first error
set -e
# Temporary directory for the build
TMP="/var/tmp/ubuntu-build"
#!/bin/bash
iatest=$(expr index "$-" i)
#######################################################
# SOURCED ALIAS'S AND SCRIPTS BY zachbrowne.me
#######################################################
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
@NickHollow
NickHollow / TrueColour.md
Created February 16, 2021 18:59 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)
@NickHollow
NickHollow / setup-sandbox.sh
Created February 16, 2021 01:49 — forked from adamhooper/setup-sandbox.sh
Build a 20GB-or-less chroot layer
#!/bin/bash
set -e
CHROOT=/var/lib/workbench/chroot # Empty
BASE_LAYER=/var/lib/workbench/chroot-base # already populated with /etc, /lib, /usr...
CHROOT_SIZE=20G # max size of user edits
VENV_PATH="/root/.local/share/virtualenvs" # only exits in dev
# /app/common (base layer)
@NickHollow
NickHollow / gist:7be4521feb9f1ae97d02ce463e695a29
Created February 8, 2021 18:59 — forked from fomigo/gist:2382775
Russian Plural Form in PHP
<?php
/*
echo plural_form(42, array('арбуз', 'арбуза', 'арбузов'));
*/
function plural_form($n, $forms) {
return $n%10==1&&$n%100!=11?$forms[0]:($n%10>=2&&$n%10<=4&&($n%100<10||$n%100>=20)?$forms[1]:$forms[2]);
}
@NickHollow
NickHollow / install-laptop.sh
Created February 5, 2021 21:06 — forked from ondt/install-laptop.sh
Blbuntu installation scripts
#!/bin/bash
# install Ubuntu (full install install)
# --> full install
# --> no swap
# setup wifi
# mount /data
gnome-disks
@NickHollow
NickHollow / openrc-init-pia
Created January 26, 2021 10:29 — forked from triffid/openrc-init-pia
shell script for accessing PIA wireguard
#!/sbin/openrc-run
command="/root/bin/pia-wg.sh"
CONFIGDIR="${CONFIGDIR:-/var/cache/pia-wg}"
CONFIG="${CONFIG:-/etc/pia-wg/pia-wg.conf}"
extra_started_commands="reload"
depend() {
@NickHollow
NickHollow / TODOTableBuilder.sh
Created January 22, 2021 19:21 — forked from I82Much/TODOTableBuilder.sh
A bash script to create an HTML table of the TODO items left in a directory
#!/bin/sh
# From http://www.linuxweblog.com/bash-argument-numbers-check
EXPECTED_ARGS=1
E_BADARGS=65
if [ $# -gt $EXPECTED_ARGS ]
then
echo "Usage: ./extract [starting_directory]" >&2
exit $E_BADARGS
fi
@NickHollow
NickHollow / ask.sh
Created January 1, 2021 05:19
Bash General-Purpose Yes/No Prompt Function ("ask")
# This is a general-purpose function to ask Yes/No questions in Bash, either
# with or without a default answer. It keeps repeating the question until it
# gets a valid answer.
ask() {
# https://djm.me/ask
local prompt default reply
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"
@NickHollow
NickHollow / cb.sh
Created December 31, 2020 20:38 — forked from blurayne/cb.sh
SSH Remote Forwarded Clipboard
##
# SSH Remote Forwarded Clipboard
#
# Advantages
# You can copy stuff on a remote machine to your local clipboard (e.g. you could use the script in a shell theme)
# It is not intended to do it the other way round (makes no sense since you usually will use your local clipboard)
#
# Security Concerns
# Someone else on the remote host could spam or exploit your clipboard exploit it (xsel, xclipbaord, parcellite etc.)
#