Skip to content

Instantly share code, notes, and snippets.

@sternenseemann
sternenseemann / printer.sh
Last active December 16, 2015 23:59
adnprinter – Print posts of a adn-hashtag
#!/bin/bash
# Depencies: lp & wry
search='#adnprinter' # hashtag/search
count=7 # How many post should be printed?
cd /adnprinter #change that to cd /path/to/adnprinter
posts=$(wry search $search -c $count)
if test "$posts" != "$(cat ./ref.txt)"
then echo "$posts" > ./ref.txt
lp ./ref.txt
@sternenseemann
sternenseemann / uberspace-fb.diff
Last active December 24, 2015 19:59
Patch for Filebin to get it working on uberspace.de
diff --git a/application/controllers/file.php b/application/controllers/file.php
index 7d701b7..16c6d75 100644
--- a/application/controllers/file.php
+++ b/application/controllers/file.php
@@ -316,7 +316,7 @@ class File extends MY_Controller {
echo '<div class="table-row">'."\n";
echo '<div class="table-cell">'."\n";
// TODO: use exec safe and catch exception
- $r = (new \libraries\ProcRunner(array(FCPATH.'scripts/Markdown.pl', $file)))->forbid_stderr()->exec();
+ $r = (new \libraries\ProcRunner(array('perl '.FCPATH.'scripts/Markdown.pl', $file)))->forbid_stderr()->exec();
@sternenseemann
sternenseemann / blink.c
Last active August 29, 2015 14:05
avr blink program
@sternenseemann
sternenseemann / infinite.hs
Created December 6, 2015 14:02
Infinite Lists
module Data.Infinite where
import Prelude hiding (iterate, take, drop)
data Infinite a = Cons a (Infinite a) deriving Show
simple :: a -> Infinite a
simple x = Cons x $ simple x
iterate :: a -> (a -> a) -> Infinite a
(ql:quickload "chirp")
(ql:quickload "trivial-http")
(defparameter chirp:*oauth-api-key*
"toplel")
(defparameter chirp:*oauth-api-secret*
"lolnope")
(defparameter chirp:*oauth-access-token*
"roflmao")
(defparameter chirp:*oauth-access-secret*
#!/bin/sh
nix-shell -p pkgs.opam pkgs.ocamlPackages_4_03.ocaml pkgs.aspcud pkgs.m4 pkgs.gnumake pkgs.binutils pkgs.gcc pkgs.gmp \
--command ". $HOME/.opam/opam-init/init.sh; eval \`opam config env\`; return" \
-I nixpkgs=$HOME/src/nix/nixpkgs
@sternenseemann
sternenseemann / tokenize.c
Last active November 24, 2016 23:16
Appearantly a lisp tokenizer
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <ctype.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#define TOKENS_CHUNK 50
@sternenseemann
sternenseemann / warpspeed.hs
Created March 12, 2017 14:26 — forked from Profpatsch/warpspeed.hs
Like python’s SimpleHTTPServer.
#!/usr/bin/env nix-shell
#!nix-shell -i runhaskell -p "haskellPackages.ghcWithPackages (hps: with hps; [wai-middleware-static warp unix])"
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Network.Wai
import Network.Wai.Middleware.Static
import Network.Wai.Handler.Warp
import Network.HTTP.Types.Status
import System.Posix.Directory
[Definition]
failregex = pam_unix\(rpam:auth\): authentication failure; logname=.* uid=\d* euid=\d* tty=.* ruser=.* rhost=<HOST>\s*user=.*$
@sternenseemann
sternenseemann / philcite.sty
Last active October 6, 2019 15:19
LaTeX Bibliografiestil für Philosophie
\ProvidesPackage{philcite}
\usepackage{csquotes}
\usepackage[%
style=philosophy-verbose%
, sorting=nyt%
, shorthandintro=true%
, loccittracker=context%
, inbeforejournal=true
]{biblatex}