Skip to content

Instantly share code, notes, and snippets.

@powerswitch
powerswitch / APA102.ino
Created November 14, 2016 19:08
Simple APA102 controller via serial and Arduino
int clk = 12;
int dat = 13;
int clockspeed = 0;
unsigned long timer;
#define MAXLEDS 19
byte ledred[MAXLEDS];
byte ledgreen[MAXLEDS];
@powerswitch
powerswitch / ET6202.ino
Last active May 2, 2024 22:50
Arduino code for ET6202 LED driver chip
// Connect your ET6202 pins and adapt constants below accordingly
const int kPinStb = 4; // Serial interface command mode port
const int kPinClk = 3; // Clock input port
const int kPinData = 2; // Data input and output port
/**
* Command (aka Order) to send to the chip.
*/
enum Order {
@powerswitch
powerswitch / brightness.lua
Created August 28, 2015 10:47
Awesome WM: LCD Brightness lib
-- Handle brightness (with xbacklight)
local awful = require("awful")
local naughty = require("naughty")
local tonumber = tonumber
local string = string
local os = os
-- A bit odd, but...
require("lib/icons")
@powerswitch
powerswitch / greylock.sh
Created May 29, 2015 19:48
Create a screenshot, color it, blur it and lock the screen.
!/bin/bash
# Dependencies:
# imagemagick
# i3lock-color-git
IMAGE=/tmp/i3lock.png
# All options are here: http://www.imagemagick.org/Usage/blur/#blur_args
BLURTYPE="0x3" # 7.52s
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from itertools import chain
import os, re
import pp
import sys
def pointsto(url, target):
try:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from lxml import etree
from itertools import chain
import os, re
URL_PREFIX='http://de.wikipedia.org/'
URL=URL_PREFIX+'w/index.php?title=Spezial%3AAlle+Seiten&from=&to=&namespace=0'
# bash double face palm
while (true)
do
echo -en "\r_o_"; sleep 0.5
echo -en "\r\o/"; sleep 0.2
echo -en "\r|o|"; sleep 0.2
echo -en "\r A "; sleep 0.5
done
#!/usr/bin/python
# merge two xournal/cournal files of same document
import gzip
import sys
if len(sys.argv) != 4:
print("usage: mergexoj.py FILE1 FILE2 OUTPUT")
exit()
#!/usr/bin/bash
# Finde alle Filmordner
MOVIES=$(find . | grep STREAM$)
# Für jeden Film:
for M in $MOVIES
do
# Liste alle Filmdateien auf
@powerswitch
powerswitch / klappe.html
Last active January 4, 2016 02:29
Einfache Synchronklappe für Filmaufnahmen usage: klappe.html?1&2 1 = szene 2 = take
<html>
<head>
<style>
html,body {
background-color: #888;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
text-align: center;