Skip to content

Instantly share code, notes, and snippets.

View camilstaps's full-sized avatar

Camil Staps camilstaps

View GitHub Profile
@camilstaps
camilstaps / wireless.sh
Last active March 2, 2016 12:08 — forked from pimeys/wireless.sh
Wireless plugin for xmobar
#!/bin/bash
INTF=$1
iwconfig "$INTF" 2>&1 | grep -q no\ wireless\ extensions\. && {
echo wired
exit 0
}
essid=`iwconfig "$INTF" | grep 'ESSID:' | cut -d' ' -f 2- | sed 's/^ *//g' | cut -d' ' -f 4- | sed 's/ *$//g'`
essid="${essid:7:(-1)}"
quality=`iwconfig "$INTF" | grep 'Link Quality' | sed 's/^ *//g' | cut -d'=' -f2 | cut -d' ' -f1`
@camilstaps
camilstaps / factorial.htaccess
Created April 18, 2016 18:30
Factorial in Apache rewrite rules
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^just/(1*)/?$ /index.php?just=$1 [L]
RewriteRule ^add-and/(\w+)/1(1*)/(1+)(/.*)$ /$1/$2$3$4
RewriteRule ^add/(1+)/(1+)/?$ /add-and/just/$1/$2/
@camilstaps
camilstaps / IKS.icl
Last active August 3, 2016 10:20
IKS Interpreter
module IKS
import StdArray, StdFile, StdList, StdOverloaded, StdString
from StdFunc import o
import StdDynamic
import Data.Functor
import Control.Applicative
import Control.Monad
@camilstaps
camilstaps / lambda.tex
Created September 10, 2017 00:51
Lambda Calculus in TeX
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\usepackage{fancyvrb}
\fvset{tabsize=2}
\title{Lambda Calculus in \TeX}
\author{Camil Staps}
@camilstaps
camilstaps / dyn.icl
Last active February 18, 2018 08:12
Monomorphic dynamics without language support
module dyn
import StdEnv
import Data.Maybe
:: Type
= Cons String
| App Type Type
instance == Type
@camilstaps
camilstaps / fst.icl
Last active March 4, 2019 12:10
Arity-agnostic fst function in Clean
module fst
fst :: a -> b // (a,b)->a, (a,b,c)->a, (a,b,c,d)->a, etc.
fst _ = code {
get_node_arity 0
push_b 0
push_b 0
repl_args_b
decI
.o 2 1 i
@camilstaps
camilstaps / HTML_math_editor.user.js
Last active June 13, 2021 04:06
Stack Exchange HTML math editor
// ==UserScript==
// @name Stack Exchange HTML math editor
// @author Camil Staps <info@camilstaps.nl>
// @namespace nl.camilstaps.htmlmath
// @description Adds a math bar to the Stack Exchange editor
// @include /^https?:\/\/(.*\.)?stackoverflow\.com/.*$/
// @include /^https?:\/\/(.*\.)?serverfault\.com/.*$/
// @include /^https?:\/\/(.*\.)?superuser\.com/.*$/
// @include /^https?:\/\/(.*\.)?stackexchange\.com/.*$/
// @include /^https?:\/\/(.*\.)?askubuntu\.com/.*$/
@camilstaps
camilstaps / WritingPseudocode.md
Last active March 31, 2023 02:13
How to write good pseudocode

How to write good Pseudocode

This is an unfinished list of remarks on how to write good pseudocode.

What is pseudocode?

Pseudocode is a loosely defined way of transmitting the concept of an algorithm from a writer to a reader. Central is the efficiency of this communication, not the interpretability of the code by an automated program (e.g., a parser).