Skip to content

Instantly share code, notes, and snippets.

@tcpj
tcpj / main.cpp
Last active January 23, 2024 20:23
FREKVENS snippet
#include <Arduino.h>
void setup() {
pinMode(PB3, OUTPUT); // clk
pinMode(PB4, OUTPUT); // latch
pinMode(PB5, OUTPUT); // data
for (int i = 0; i <= 255; i++) {
digitalWrite(PB5, HIGH);
digitalWrite(PB3, HIGH);
@tcpj
tcpj / display.py
Last active February 19, 2023 09:08
IKEA VINDSTYRKA MicroPython driver
from machine import Pin
# Constants
COMMAND_MODE = 0x80
WRITE_MODE = 0xA0
BIAS = 0x52 # Bias 1/2, 4 common
INT_OSC = 0x30 # Internal RC oscilator
SYS_DIS = 0x00
SYS_EN = 0x02
@tcpj
tcpj / ttycka.py
Last active July 19, 2021 13:35
TTYcka
import qrcode
import requests
import sys
import uuid
DEVICE_NAME = "TTYcka"
BASE_UZIS_URL="https://ocko.uzis.cz/api/v2/"
BASE_NIA_URL="https://ocko.uzis.cz/Account/Prihlaseni"
AUTH_ENDPOINT="auth/login"
PERSON_ENDPOINT="person"
"""
Simple brainfuck interpreter
Copyright (c) <2016> <Jakub Dušek> [email protected]
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
@tcpj
tcpj / dijkstra.py
Created June 3, 2016 16:33
Dijkstra
from collections import OrderedDict
nodes = {
"a": {"a": 0, "b": 4, "c": 1},
"b": {"b": 0, "d": 2},
"c": {"c": 0, "b": 5, "d": 6},
"d": {"d": 0, "k": 7},
"k": {"k": 0}
}