Skip to content

Instantly share code, notes, and snippets.

View diginc's full-sized avatar
🐳

Adam B Hill diginc

🐳
View GitHub Profile
@diginc
diginc / KVM-QEMU VNC over SOCKS
Last active October 18, 2023 05:47
How to connect to KVM-QEMU guests over SSH SOCKS Proxy. EXAMPLE of how to setup VNC for ALL your guests, without having to port forward/port tunnel every single 590# number
$ # EXAMPLE of how to setup VNC for ALL your guests, without having to port forward/port tunnel every single 590# number
$ cat ~/.ssh/config
# Host Machines
Host host_a.prod.domain.com
User diginc
DynamicForward 127.0.0.1:1080
# Used with VNCViewer (RealVNC) like so (FullColor fixes the immediate disconnect bug)
# `vncviewer --ProxyServer=127.0.0.1:1080 --ProxyType=socks --FullColor 127.0.0.1:5901`
@diginc
diginc / macros.ahk
Last active November 14, 2020 18:05
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; https://autohotkey.com/docs/KeyList.htm
; left hand mouse config
; Accidently hitting numlock a lot...maybe move 'homerow' from 789' to '456'?
import requests
import sys
import time
import os
def main():
trigger_url = sys.argv[1]
trigger_resp = requests.get(trigger_url)
# SETUP DOCKER
sudo bash
docker ps
apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=arm64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
#!/bin/bash
BASE='https://raw.githubusercontent.com/stevemao/diff-so-fancy/master/'
for i in diff-so-fancy diff-highlight; do
wget -O ~/bin/$i ${BASE}${i}
chmod +x ~/bin/$i
done;
git --version && git config --global core.pager "diff-highlight | diff-so-fancy | less --tabs=1,5 -R"

Intro

'2 CLI windows? Why not tmux'

Learn the basics of my tmux config (stock is not wonderful)

From : https://en.wikipedia.org/wiki/Tmux " tmux is a software application that can be used to multiplex several virtual consoles, allowing a user to access multiple separate terminal sessions inside a single terminal window or remote terminal session. It is useful for dealing with multiple programs from a command line interface, and for separating programs from the Unix shell that started the program.[1] It provides much of the same functionality as GNU Screen, but is distributed under a BSD license."

Terms:

  • Tabs = numbered windows within a single session
@diginc
diginc / gist:8526252
Last active January 3, 2016 22:09
~/bin $ cat tm-default
#!/bin/bash
TMUXNAME=${1:-"default"}
if tmux ls | grep "^$TMUXNAME:"; then
tmux attach -d -t $TMUXNAME
else
tmux new -s $TMUXNAME
fi
@diginc
diginc / gist:8525360
Last active January 3, 2016 21:59
.tmux.conf
# .tmux.conf based off http://pragprog.com/book/bhtmux/tmux
# Setting the prefix from C-b to C-a
set -g prefix C-a
# Free the original Ctrl-b prefix keybinding
unbind C-b
# Ensure that we can send Ctrl-A to other apps
# useful for bash jump to start of line C-a C-a
bind C-a send-prefix
#!/bin/bash
RELEASE=`lsb_release --codename | cut -f2`;
DLDEST="/opt/puppetlabs-release-$RELEASE.deb";
if [[ `dpkg -l | grep -c 'puppetlabs-release'` -gt 0 ]] ; then
echo "$DLDEST already installed"
else
sudo wget http://apt.puppetlabs.com/puppetlabs-release-$RELEASE.deb -O $DLDEST;
sudo dpkg -i $DLDEST;
sudo apt-get update;
sudo apt-get install -o Dpkg::Options::="--force-confold" --force-yes -y puppet;
Use git for all steps of the process.
Write a server that knows how handle a TODO list. Preferably test driven. Initially the server can use a very simple in-memory collection of items. If time permits, we can have it backed with a database living in another docker container.
Server:
GET /todos
PUT /todos {"title": "<TITLE>", "message": "<MESSAGE"}. Returns the location in the header
GET /todos/ID Returns single note.
POST /todos/ID {"id": "<ID>", "title": "<TITLE>", "message": "<MESSAGE"}. Updates a note
POST /search {"title": "<TITLE_SEARCH_STRING>", , "message": "<MESSAGE_SEARCH_STRING"}. Returns all the todos with a title or message that matches the search. Maybe the search string could be a regex.