Skip to content

Instantly share code, notes, and snippets.

View qguv's full-sized avatar
vibing

Quint Guvernator qguv

vibing
View GitHub Profile
@qguv
qguv / gitit.service
Created May 21, 2017 19:34
systemd service for gitit
[Unit]
Description=Run Gitit Wiki
After=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/gitit --config-file /etc/gitit/gitit.conf
WorkingDirectory=/srv/gitit
User=gitit
@qguv
qguv / led.sh
Created May 7, 2017 04:04
OpenWRT Blinkenlights
#!/bin/sh
LED_PATH="/sys/devices/platform/leds-gpio/leds"
GREEN="gl-connect:green:lan"
RED="gl-connect:red:wlan"
ssleep () {
head -c "${1}00000" /dev/zero > /dev/null
}
#!/bin/bash
# exit on first fail, die on unset variables, don't glob, pipes fail on first failure
set -euf -o pipefail
cd spb
git pull --force
make
rm -rf html
mkdir html
# spb
# everything redirects to the HTTPS, non-www subdomain
# redirect http(s)://www to https://
server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
@qguv
qguv / userland_talk.md
Last active March 2, 2017 22:28
Userland talk for W&M ACM

UNIX: userland and the shell

  • GUI file managers are built on top of coreutils (GNU/BSD)
  • you can just run the coreutils directly in a shell
    • reads command and spits out the result
    • matrix of monospaced text
  • syntax: binary space arg1 space arg2 space ...

exercises

@qguv
qguv / ls.c
Last active February 7, 2017 09:30 — forked from syntactician/ls.c
#include <stdio.h> /* printf, puts, putchar */
#include <unistd.h> /* fork, execv */
#include <sys/ioctl.h> /* get username */
#include <sys/wait.h> /* join processes */
#include <sys/types.h> /* pid_t */
#include <string.h> /* strcpy, strncpy, memcpy */
#define MAX_WIDTH 80
#define MAX_CMD 64
@qguv
qguv / gist:b57be7657a6e0fc99c7e9865471f052a
Last active October 20, 2016 06:12
Faster Computers (using only the ten hundred most used words)
Computers are great because they do exactly what they're told, very fast. But
sometimes, we need things done faster than a computer can do them. What can we
build that's faster than a computer?
If you want to work on something, it will be faster if your friend does one
part while you do another. Two people working on different things at the same
time are faster than one person doing everything alone.
Computers work the same way: If you can break up what you want the computer to
do into smaller things, and then get different computers to work on those
@qguv
qguv / gauss.ipynb
Last active November 28, 2021 19:51
Gaussian elimination (incomplete)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@qguv
qguv / colemak.svg
Created August 22, 2016 22:53
Vi(m) graphical cheat sheet, colemak style
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@qguv
qguv / multibuild.py
Created August 22, 2016 22:48
Build a buncha different versions
#!/usr/bin/env python3
from itertools import zip_longest
from os import chdir, environ, getcwd, makedirs
from pathlib import Path
from subprocess import CalledProcessError, check_call
from sys import argv, exit
def commits_from_file(filename):
with open(filename, 'r') as f: