Skip to content

Instantly share code, notes, and snippets.

View terinjokes's full-sized avatar

Terin Stock terinjokes

View GitHub Profile
@terinjokes
terinjokes / 01-override_term.patch
Last active January 8, 2021 21:05
OpenSSH 8.4p1 OverrideTerm option
diff --git a/mux.c b/mux.c
index 376f0d71..a240664d 100644
--- a/mux.c
+++ b/mux.c
@@ -1922,7 +1922,9 @@ mux_client_request_session(int fd)
close(devnull);
}
- if ((term = getenv("TERM")) == NULL)
+ term = options.override_term ? options.override_term : getenv("TERM");
--- arch-config 2020-12-29 22:22:45.661044626 -0800
+++ nixos-config 2020-12-29 19:41:49.856275201 -0800
@@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
-# Linux/x86_64 5.10.3 Kernel Configuration
+# Linux/x86_64 5.10.2 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (GCC) 9.3.0"
CONFIG_CC_IS_GCC=y
@terinjokes
terinjokes / 00-configuration.nix
Last active December 30, 2020 06:30
XPS 13 9310 NixOS with working Bluetooth
{ config, pkgs, lib, ... }:
let
archKernel = (pkgs.linuxManualConfig rec {
inherit (pkgs) stdenv;
version = "5.10.3";
modDirVersion = "5.10.3";
src = pkgs.fetchurl {
url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
@terinjokes
terinjokes / u-boot-x86_64-zboot.patch
Created December 27, 2020 13:19
terrible hack to get u-boot 2020.10 to boot bzImages with sysboot
diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
index 8716e782f6..214baf18b0 100644
--- a/cmd/pxe_utils.c
+++ b/cmd/pxe_utils.c
@@ -552,6 +552,17 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
/* Try booting a Image */
else
do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
+#elif defined(CONFIG_CMD_ZBOOT)
+ else {
@terinjokes
terinjokes / 00-README.org
Last active January 28, 2022 21:16
Retro Tea Breaks Vol. 1 PDF Patch

Retro Tea Break: Vol. 1 QPDF Diff

This is a diff to the Retro Tea Break: Vol. 1 PDF that fixes several problems:

  • Corrects the PDF page number offset, so they match the physical book’s page numbers.
  • Removes the forced page fitting from the link annotations, such as those on the contents listing page.
  • Adds a document outline to the PDF, so your PDF viewer can provide direct links to chapters.

Usage

@terinjokes
terinjokes / klogs.zsh
Last active February 26, 2023 23:20
FZF function for Kubernetes logs (including previewing)
klogs() {
pod="$(kubectl get po -o wide|tail -n+2|fzf -n1 --reverse --tac --preview='kubectl logs --tail=20 --all-containers=true {1}' --preview-window=down:50%:hidden --bind=ctrl-p:toggle-preview --header="^P: Preview Logs"|awk '{print $1}')"
if [[ -n $pod ]]; then
kubectl logs --all-containers=true $pod
fi
}
@terinjokes
terinjokes / vpnc-v6-split.patch
Created April 4, 2018 19:03
patch to never set the default route for split IPv6
diff -ura vpnc-scripts.orig/vpnc-script vpnc-scripts.new/vpnc-script
--- vpnc-scripts.orig/vpnc-script 2018-04-04 11:39:54.203748883 -0700
+++ vpnc-scripts.new/vpnc-script 2018-04-04 11:52:22.039505461 -0700
@@ -676,11 +676,7 @@
while [ $i -lt $CISCO_IPV6_SPLIT_INC ] ; do
eval NETWORK="\${CISCO_IPV6_SPLIT_INC_${i}_ADDR}"
eval NETMASKLEN="\${CISCO_IPV6_SPLIT_INC_${i}_MASKLEN}"
- if [ $NETMASKLEN -lt 128 ]; then
- set_ipv6_network_route "$NETWORK" "$NETMASKLEN"
- else
@terinjokes
terinjokes / client.go
Last active May 6, 2021 05:13
Golang example of context in API Clients
package api
import (
"encoding/json"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
)
type Client {
@terinjokes
terinjokes / foobar.ex
Last active December 30, 2015 23:08
Simple Elixir lambda example
defmodule FooBar do
def update_header(headers, key, fun) do
if List.keymember?(headers, key, 0) do
value = fun.(headers)
List.keystore(headers, key, 0, {key, value})
else
value = fun.(nil)
List.keystore(headers, key, 0, {key, value})
end
end
@terinjokes
terinjokes / 01-underground.md
Created October 24, 2015 12:45
Server Codenames

Single word London Underground stations

  • Bermondsey
  • Upney
  • Neasden
  • Croxley
  • Hainault
  • Gunnersbury
  • Greenford
  • Leytonstone
  • Chigwell