Skip to content

Instantly share code, notes, and snippets.

View njbbaer's full-sized avatar

Nate Baer njbbaer

View GitHub Profile
@njbbaer
njbbaer / tunnel-ssh.service
Created July 30, 2017 08:01
autossh reverse tunnel systemd service file
[Unit]
Description=autossh reverse tunnel
After=network.target
[Service]
User=<local_user>
Environment="AUTOSSH_GATETIME=0"
ExecStart=/usr/bin/autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 10" -NR <remote_port>:localhost:<local_port> <remote_user>@<address>
[Install]
@njbbaer
njbbaer / ca.py
Last active October 27, 2022 18:05
Fast implementation of cellular automata using 2D convolution
import time
import numpy as np
from numpy.fft import fft2, ifft2
from matplotlib import pyplot, animation
def fft_convolve2d(board, kernal):
board_ft = fft2(board)
kernal_ft = fft2(kernal)
height, width = board_ft.shape
@njbbaer
njbbaer / fog-creek.py
Last active August 6, 2016 08:28
Solution to Fog Creek's developer puzzle
'''
http://www.fogcreek.com/jobs/dev
Find a 9 letter string of characters that contains only letters from: acdegilmnoprstuw
such that the hash(the_string) is: 945924806726376
if hash is defined by the following pseudo-code:
Int64 hash (String s) {