Skip to content

Instantly share code, notes, and snippets.

@andreasf
andreasf / dashboard.html
Created July 31, 2018 17:18
CO2Meter dashboard with current values
<!DOCTYPE html>
<html lang="en">
<head>
<title>CO2 dashboard</title>
<meta charset="utf-8">
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<style>
/* CSS to go here */
@andreasf
andreasf / Makefile
Created October 9, 2014 21:35
Download and build GNU Bash 4.2.53
all: download clean extract patch build check
download:
if [ ! -e "bash-4.2.tar.gz" ]; \
then \
wget -nv https://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz; \
fi; \
if [ ! -e "patches-4.2" ]; then \
mkdir patches-4.2; \
cd patches-4.2; \
/***************************************************************************
* copyright : (C) 2003-2013 by Pascal Brachet *
* addons by Luis Silvestre ; S. Razi Alavizadeh *
* http://www.xm1math.net/texmaker/ *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation either version 2 of the License, or *
* (at your option) any later version. *
* *
@andreasf
andreasf / nginx-ldapauthd
Last active January 29, 2017 05:35
nginx-ldapauthd: a backend for the nginx auth_request module
#!/usr/bin/env python
# -*- coding=utf8 -*-
"""
nginx-ldapauthd
===============
A backend for the nginx auth_request module.
* Listens on unix socket (SOCK_NAME) and authenticates users against LDAP
* Two modes:
#!/usr/bin/env python
"""
sctl -- a systemctl wrapper that provides instant feedback
"""
import sys
import subprocess
import os
import time
NUM_LOG_LINES = 5
#!/usr/bin/python
def main():
print("password is: " + get_passwd())
def get_passwd():
"""
getpass alternative that prints asterisks after each character.
only tested with utf-8 locales.
"""
class KenBurnsImage {
final float AMOUNT_ZOOM = 0.05; // per second
final float AMOUNT_PAN = width / 64f; // per second
final float OVERSCALE = 1.2;
PImage img;
int fadeInTime;
int created = -1;
float dispWidth = 0.0;
package models.form;
import java.util.*;
/**
* <p>An interpreter for a simple language to model question dependencies.</p>
* <code>
* EXPR ::= QUESTION COMP_OP ANSWER | "(" EXPR ")" | EXPR BOOL_OP EXPR
* COMP_OP ::= "==" | "!="
* BOOL_OP ::= "&" | "|"
@andreasf
andreasf / syslog-eventsd.py
Created March 2, 2012 21:30
python daemon that automatically stores intel gpu error states
#!/usr/bin/python
import subprocess
import shlex
import sqlite3
import datetime
import web
import hashlib
import threading
import Queue
<!DOCTYPE html>
<html>
<head>
<title>lulz</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="http://code.jquery.com/jquery.min.js"></script>
<script>
var namensdings = function()
{
var first_names = [ "Abdul", "Achim", "Adam", "Adrian", "Agnes", "Ahmad",