Skip to content

Instantly share code, notes, and snippets.

sudo apt-get -y remove docker docker-engine
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] bionic stable" # No cosmic yet?
sudo apt update
sudo apt-get -y install docker-ce
polynomialspace / Makefile
Last active December 10, 2018 09:08
Quick and dirty makefile to build migen or yosys and dependencies on fedora (Why isnt this just a shell script?)
all: migen
sudo yum install git make gcc gcc-c++
icestorm: deps
sudo yum install -y python3 libftdi-devel \
&& git clone \
&& cd icestorm \
&& make -j $(nproc) \
polynomialspace / Dockerfile
Created December 10, 2018 10:03
Docker file for migen
FROM ubuntu
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENV DEBIAN_FRONTEND=noninteractive
#^ Really, ubuntu? (tzdata hanging)
RUN apt-get update && apt-get -y install bison build-essential clang cmake flex gawk git graphviz gtkwave libboost-all-dev libffi-dev libftdi-dev libreadline-dev python3 python3-dev python3-setuptools qt5-default tcl-dev xdot
RUN git clone && cd icestorm && make -j $(nproc) && make install
RUN git clone && cd nextpnr && cmake -DARCH=ice40 . && make -j $(nproc) && make install
polynomialspace / gist:9ccfa7c922d4acba52e21016889c3ae2
Created February 17, 2019 07:43
Quick command list to create a debian container with systemd-nspawn
cd /var/lib/machines
debootstrap stable ./debian
systemd-nspawn -M debian
echo 'deb stable/updates main' >> /etc/apt/sources.list
apt update && apt -y upgrade
apt install -y sudo
useradd -mUG sudo -s /bin/bash debian #kind of pointless.
passwd -d debian
polynomialspace /
Created September 23, 2019 16:39
script to generate .ovpn files, assumes several things, see
if [ -z "${CLIENT}" ]; then
exit 1
cd /etc/openvpn
polynomialspace /
Last active September 23, 2019 20:18
Quick script to scrape ssh pubkeys from a server via ssh-keyscan and sign them with an SSH CA
umask 77
TMPDIR=$(mktemp -d)
cd ${TMPDIR}
for TYPE in dsa ecdsa ed25519 rsa; do
# ssh-key{gen,scan} are very smart and their outputs are not directly compatible, very cool
polynomialspace /
Last active September 23, 2019 20:29
Script to scp ssh pubkeys from a server and sign them with a local CA; still tweaking things.
print_help() {
echo "A script to copy ssh host keys via SCP and sign them with a local SSH CA"
echo "Simple usage: ${0} -h <host>"
echo "The following options are accepted:"
echo " -h: specify the host"
echo " -H: override the hostname for SCP (default: same as -h)"
echo " -s: override location of CA privkey (default: /etc/ssh/ca)"
polynomialspace / badfizzbuzz.go
Last active October 8, 2019 20:20
Attempts to write the most inane but readable form of fizzbuzz in go
package main
import (
func main() {
fbarr := []string { "%[2]sFizzBuzz", "%[1]d", "%[1]d",
"%[2]sFizz" , "%[1]d", "%[2]sBuzz",
"%[2]sFizz" , "%[1]d", "%[1]d",
polynomialspace / rot13.go
Last active March 4, 2020 11:35
rot13 / caesar implementation in go (bad/kinda silly)
package main
import (
// double curly brackets to provide arbitrary scoping for variable shadowing.
// this is rather disgusting, but cleaner than repeat casts or more vars.
polynomialspace / atou.go
Last active March 4, 2020 21:21
"ascii to fullwidth" convert plaintext standard chars to fullwidth
package main
import (
func atofw(in string) (out string) {