Skip to content

Instantly share code, notes, and snippets.

View pkage's full-sized avatar
🛠️
writing

Patrick Kage pkage

🛠️
writing
View GitHub Profile
@pkage
pkage / caffienate.sh
Created May 1, 2019 10:25
caffienate your dice machine
#! /bin/sh
echo "keeping screen awake... (ctrl-c to exit)"
# literally move the mouse back and forth every ten minutes
while [ true ]
do
xdotool mousemove_relative --sync -- 1 0
xdotool mousemove_relative --sync -- -1 0
sleep 600
http {
# ...
server {
server_name yourdomain.com;
location / {
proxy_pass http://localhost:8888;
}
}
# ...
@pkage
pkage / index.css
Created January 21, 2019 22:54
really simple sidebar with animation
body {
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
}
@pkage
pkage / .bashrc
Last active April 10, 2019 13:53
Dotfiles
alias l="ls -AFG"
alias ll="ls -lFGhA"
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias res="cd ~/repositories";
alias weather="curl wttr.in"
alias vi="nvim"
alias vim="nvim"
export EDITOR="nvim"
@pkage
pkage / harness.hs
Created December 12, 2018 19:51
FP example harness
-- Super simple test harness for the FP exam
examples :: (a -> b) -> [a] -> [b]
examples = map
examples2 :: (a -> b -> c) -> [(a,b)] -> [c]
examples2 fn cases = [uncurry fn cse | cse <- cases]
-- Use them like
@pkage
pkage / hhgtpnlp.md
Created November 17, 2018 08:04
A Hitchhiker's Guide to Python + NLP

(note: originally written for an email)

The Hitchhiker's Guide to Python + NLP


don't panic

Foreword

@pkage
pkage / examplefetch.js
Created October 28, 2018 21:48
example fetch
// normal fetch (using Promise interface)
fetch('http://findoslice.tardis.ed.ac.uk/api/get_token')
.then(r => r.json())
.then(r => {
console.log(r) // response body
})
// normal fetch (using async/await syntax)

Keybase proof

I hereby claim:

  • I am pkage on github.
  • I am pkage (https://keybase.io/pkage) on keybase.
  • I have a public key whose fingerprint is 5D59 9CDD 9CED DCBC 1323 E5F8 298E 9E7D CEFF 1D84

To claim this, I am signing this object:

@pkage
pkage / dec2bin.c
Created July 30, 2018 05:45
An annotated C decimal to binary conversion
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main() {
// read our number
int number;
printf("Input a decimal number: ");
scanf("%d", &number);
@pkage
pkage / guess.c
Created July 19, 2018 07:25
An annotated C guessing game.
/**
* Simple number guessing game, annotated
* @author Patrick Kage
*/
// include some standard functions
#include <stdlib.h>
#include <stdbool.h>
// standard input/output