Skip to content

Instantly share code, notes, and snippets.

Avatar
☢️

John Andersen pdxjohnny

☢️
View GitHub Profile
View plot.awk
#!/usr/bin/awk -f
# This program is a copy of guff, a plot device. https://github.com/silentbicycle/guff
# My copy here is written in awk instead of C, has no compelling benefit.
# Public domain. @thingskatedid
# Run as awk -v x=xyz ... or env variables for stuff?
# Assumptions: the data is evenly spaced along the x-axis
# TODO: moving average
@katef
katef / life-utf8.c
Last active Jan 2, 2021
XBM to UTF-8 braille image things
View life-utf8.c
/*
* John Conway's Game of Life.
*
* This is written for POSIX, using Curses. Resizing of the terminal is not
* supported.
*
* By convention in this program, x is the horizontal coordinate and y is
* vertical. There correspond to the width and height respectively.
* The current generation number is illustrated when show_generation is set.
*
@0xdade
0xdade / selfdestruct.py
Created Jan 23, 2020
Simple code snippet for a python file to delete itself, whether it's a standalone .py file or compiled into an executable using pyinstaller
View selfdestruct.py
#!/usr/bin/env python3
'''
Determine if this python is part of an executable or a standalone script and then delete the file accordingly.
If the script has been bundled into an executable using pyinstaller (such as pyinstaller --onefile <fname>.py) then the realpath of __file__ will be incorrect, thus the use of sys.executable.
Example of just relying on __file__:
$ pyinstaller --onefile test.py
[...]
$ ls dist/
@dnoliver
dnoliver / disk-encryption.sh
Created Jan 13, 2020
Disk encryption with Clevis example
View disk-encryption.sh
GNU nano 4.3 disk-encryption.sh
#!/bin/bash
set -euxo pipefail
rpm -qa clevis* cryptsetup* luks* tpm2* e*fspr* | sort
# Creation
# dd if=/dev/zero of=/dev/sda1 bs=1M status=progress
@simpsoka
simpsoka / Leadership-CI.md
Last active Jan 7, 2021
This is a list of questions to check our decision making.
View Leadership-CI.md

Do I want to die on this hill?

  • Pass: This is morally good and if not handled has long term consequences
  • Fail: This if self serving

Am I including everyone?

  • Pass: My ego is not driving this conversation
  • Fail: The people in this conversation will only tell me I'm right and not push back
@chrisdone
chrisdone / gist:02e165a0004be33734ac2334f215380e
Last active Jan 17, 2021
Build and run minimal Linux / Busybox systems in Qemu
View gist:02e165a0004be33734ac2334f215380e

Common

export OPT=/opt
export BUILDS=/some/where/mini_linux
mkdir -p $BUILDS

Linux kernel

@drmalex07
drmalex07 / README-setup-tunnel-as-systemd-service.md
Last active Jan 7, 2021
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward
View README-setup-tunnel-as-systemd-service.md

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@julz
julz / main.go
Created Nov 20, 2015
containersched minicontainer
View main.go
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {
@jpillora
jpillora / sshd.go
Last active Jan 5, 2021
Go SSH server complete example - Read more here https://blog.gopheracademy.com/go-and-ssh/
View sshd.go
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
@cee-dub
cee-dub / sse.go
Created May 30, 2014
Simple Golang SSE example using CloseNotifier
View sse.go
package main
import (
"fmt"
"log"
"net/http"
"time"
)
// SSE writes Server-Sent Events to an HTTP client.
You can’t perform that action at this time.