Skip to content

Instantly share code, notes, and snippets.

View danackerson's full-sized avatar
🏠
Working from home

Dan Ackerson danackerson

🏠
Working from home
View GitHub Profile
@danackerson
danackerson / gist:b6f276f9979924c4836e5aef2f859291
Last active February 20, 2024 13:50
govulncheck pre-commit hook for golang projects
$ git config --global init.templateDir ~/.git-template
$ vi ~/.git-template/hooks/pre-commit
#!/usr/bin/env bash
set -e -o pipefail
if [[ -f "go.sum" ]]; then
govulncheck ./...
fi
$ cd <git repo>
$ git init
$ vi .ssh/wake_blonde-bomber.sh
#!/bin/bash
wakeonlan 2c:f0:5d:5e:84:43
while [ $(nmap "$1" -PN -6 -p ssh | grep -E 'open|closed|filtered' | awk '{print $2}') == "closed" ]
do
echo "ssh not available..."
sleep 3
done
nc "$1" "$2"
@danackerson
danackerson / .bash_profile
Last active February 9, 2021 08:47
handy aliases
### GIT ###
alias gs='git status'
alias gd='git diff'
alias gc='git commit -am'
alias gp='git push'
### K8S ###
alias k='sudo kubectl'
alias kp='k get po'
alias kap='k get pods --all-namespaces -o wide'
@danackerson
danackerson / post-ipsec-passthrough.sh
Created October 18, 2020 09:35
custom leftupdown IPSec script
#!/bin/sh
# default updown script
#
# Copyright (C) 2003-2004 Nigel Meteringham
# Copyright (C) 2003-2004 Tuomo Soini
# Copyright (C) 2002-2004 Michael Richardson
# Copyright (C) 2005-2007 Andreas Steffen <[email protected]>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
conky.config = {
update_interval = 1,
cpu_avg_samples = 2,
net_avg_samples = 2,
out_to_console = false,
override_utf8_locale = true,
double_buffer = true,
no_buffers = true,
text_buffer_size = 32768,
imlib_cache_size = 0,
@danackerson
danackerson / import LetsEncrypt pfx file for Windows Remote Desktop use
Last active September 23, 2020 04:41
Create PFX file for importing into Windows and use for Remote Desktop access
# On ubuntu@pi:
cd traefik
./traefik-certs-dumper file --version v2
cat dump/private/\*.ackerson.de.key > ackerson.pem
cat dump/certs/\*.ackerson.de.crt >> ackerson.pem
openssl pkcs12 -export -out ackerson.pfx -in ackerson.pem
# On Windows10 in an Administrator Powershell Terminal:
scp ubuntu@pi:~/traefik/ackerson.pfx .
certutil -p xyz123 -importPFX ackerson.pfx noExport

Keybase proof

I hereby claim:

  • I am danackerson on github.
  • I am danackerson (https://keybase.io/danackerson) on keybase.
  • I have a public key whose fingerprint is 5C30 3788 8012 568A E9F4 6C23 1B77 1D85 60C2 CCA0

To claim this, I am signing this object:

@danackerson
danackerson / perfectSquares.go
Created December 27, 2014 12:32
Perfect Squares
package main
import (
"math"
"math/big"
"fmt"
)
// change prime() to main() for execution => can't have 2 main()'s and go test
func main(){
index := 0
@danackerson
danackerson / 100_base.conf
Last active September 19, 2024 15:42
using nginx + lua + redis for redirects and rewrites
# using such a setup requires `apt-get install lua-nginx-redis` under Ubuntu Trusty
# more info @ http://wiki.nginx.org/HttpLuaModule#access_by_lua
http {
lua_package_path "/etc/nginx/include.d/?.lua;;";
lua_socket_pool_size 100;
lua_socket_connect_timeout 10ms;
lua_socket_read_timeout 10ms;
server {
Order deny,allow
Deny from all
AuthType Basic
AuthName "AUTHENTICATE"
AuthUserFile /etc/apache2/passwd/.htpasswd
Require valid-user
Allow from example.org 192.168
Satisfy Any