Skip to content

Instantly share code, notes, and snippets.

@jdloft
jdloft / closest.py
Created July 16, 2025 00:10
Find closest color in xterm-256color to solarized colors
import yaml
from colormath.color_objects import sRGBColor, LabColor
from colormath.color_conversions import convert_color
from colormath.color_diff import delta_e_cie2000
import numpy
def patch_asscalar(a):
return a.item()
setattr(numpy, "asscalar", patch_asscalar)
@jdloft
jdloft / install-tailscale.sh
Created July 4, 2025 19:33
Install tailscale on Comma 3x
#!/bin/sh
mount -o remount,rw /
curl -fsSL https://tailscale.com/install.sh | sh
mkdir -p /etc/systemd/system/tailscaled.service.d
mkdir -p /data/tailscale
cat <<EOF >/etc/systemd/system/tailscaled.service.d/override.conf
@jdloft
jdloft / proxy.sh
Created July 24, 2020 17:11
Looping ssh forwarding proxy
#!/bin/sh
while :; do
echo "Proxy run"
ssh -NT -o ServerAliveInterval=30 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -i $SSH_KEY -R 1234:localhost:22 USER@REMOTE
echo "End loop backoff (30s)"
sleep 30
done
@jdloft
jdloft / keyboard-test.sh
Created October 26, 2016 19:08
Keyboard testing script
#!/bin/bash
function findInArray() {
local n=$#
local value=${!n}
for ((i=1;i < $#;i++)) {
if [[ ${!i} == ${value} ]]; then # was == ${value}:*
echo "${!i}"
return 0
fi
@jdloft
jdloft / secure-shell-solarized.js
Last active February 25, 2019 06:14 — forked from johnbender/prefs.js
Set up Chrome's Secure Shell extension to use solarized terminal colors
// Disable bold.
term_.prefs_.set('enable-bold', false)
// Solarized Dark
term_.prefs_.set('background-color', "#002b36");
term_.prefs_.set('foreground-color', "#839496");
term_.prefs_.set('cursor-color', "rgba(147, 161, 161, 0.5)");
// Solarized Light
//term_.prefs_.set('background-color', "#fdf6e3");
@jdloft
jdloft / user.css
Last active January 5, 2016 16:34 — forked from thatkookooguy/user.css
This will make tty.js open up a terminal in fullscreen after a user connects & change the background color to the default purple. This should be added to tty.js/static/
.terminal {
background-color: #300A24 !important;
border: #300A24 solid 5px;
}
@jdloft
jdloft / revisr-config.md
Created November 13, 2015 04:53
How to configure Revisr for ssh

Revisr config

  1. Change www-data home dir to something like /var/lib/www-data
  2. Generate ssh key pair and place in /var/lib/www-data/.ssh/id_rsa
  3. Add ssh key to GH account
  4. Configure git username and email
  5. Set permissions on blog dir to allow www-data to write
  6. Set git remote url to use ssh protocol
@jdloft
jdloft / cvimrc
Created September 29, 2015 19:15
My cVimrc
" set noautofocus
let searchalias g = "google"
let blacklists = ["https://mail.google.com/*","*://mail.google.com/*","@https://mail.google.com/mail/*","https://koding.com/*"]
let mapleader = ","

tmux cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname