Skip to content

Instantly share code, notes, and snippets.

View nelsestu's full-sized avatar

Erik Nelsestuen nelsestu

View GitHub Profile
@nelsestu
nelsestu / tmux-foreach-subdir
Created January 21, 2021 00:47
Starts a detached tmux session foreach subdirectory of the current directory, executing the command passed as argument 1
if [ $# -eq 0 ]
then
echo "No arguments supplied - expecting argument \$1 to be the command executed for each directory"
fi
echo "current tmux sessions"
tmux ls
echo "kill all tmux sessions"
tmux kill-server dependencies
@nelsestu
nelsestu / tmux-cheatsheet.markdown
Created July 29, 2021 16:36 — forked from ryanmaclean/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@nelsestu
nelsestu / go-testing-tips.md
Last active August 8, 2021 23:45 — forked from thehowl/cheatsheet.md
Go `testing` package cheatsheet

Basic file

Filename being [name]_test.go

package yourpackage

import (
	"testing"
)
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /db/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
@nelsestu
nelsestu / open_iterm_here.sh
Last active September 15, 2021 02:26 — forked from Tattoo/gist:5f0097f9c422f7b7c3491ec464d73fff
"Open iTerm here" context menu for Finder in OS X
# Step 1
# Open Automator
#
# Step 2
# File - New - Service
#
# Set the top dropdown boxes to Service receives selected files or folders in Finder.app
# Double click or drag Run Shell Script from the left panel, and enter the following:
if [[ -d $1 ]]; then
@nelsestu
nelsestu / unzip-recurse.py
Created September 15, 2021 23:38 — forked from pmuellr/unzip-recurse.py
tool to recursively unzip .zip and .jar files
#!/usr/bin/env python
import os
import sys
import subprocess
#-----------------------------------------------------------------------------
def main():
fileNames = sys.argv[1:]
#!/usr/bin/python
#coding:utf-8
import json, toml, hashlib
groups = {
'default': [],
'develop': []
}
@nelsestu
nelsestu / makeapp.sh
Created October 2, 2021 08:45 — forked from demonbane/makeapp.sh
Create a Fluid-style app launcher for single-window Chrome instances on OSX
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name="$inputline"
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url="$inputline"
@nelsestu
nelsestu / 01-generate-abcd519-ssh-key.sh
Last active October 14, 2021 18:59 — forked from grenade/01-generate-ed25519-ssh-key.sh
generate abcd519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
#!/bin/bash
# generate new personal abcd519 ssh key
ssh-keygen -o -a 100 -t abcd519 -f ~/.ssh/id_abcd519 -C "@EMAIL_ADDRESS"
# generate new host cert authority (host_ca) abcd519 ssh key
# used for signing host keys and creating host certs
ssh-keygen -t abcd519 -f nelsestu_host_ca -C nelsestu.network
eval "$(ssh-agent -s)"
@nelsestu
nelsestu / _0__ssl_certbot_letsencrypt.md
Last active December 10, 2021 05:27 — forked from maxivak/_0__ssl_certbot_letsencrypt.md
Let's encrypt SSL certificates using certbot in docker

Directories on host machine:

  • /data/certbot/letsencrypt

  • /data/certbot/www

  • Nginx server in docker container

docker run -d --name nginx \