Skip to content

Instantly share code, notes, and snippets.

View NewProggie's full-sized avatar
👨‍💻
Working...

Kai Wolf NewProggie

👨‍💻
Working...
View GitHub Profile
// Pin assignments from LAWO ESP32 controller by nalx @ section77
const byte DATA = 0;
const byte COL1 = 21;
const byte COL2 = 19;
const byte COL3 = 23;
const byte COL4 = 18;
const byte COL5 = 5;
const byte ROW1 = 17;
const byte ROW2 = 16;
const byte ROW3 = 4;
@NewProggie
NewProggie / date_bezel_to_time.py
Last active December 15, 2021 22:15
Convert date bezel to time
# Small utility to help me set the correct time on my Swatch watch reference:
# Sistem51 Hodinkee Stoplight Neon Remix watch
from math import floor, trunc
def frac(n):
return n - floor(n)
# Copyright (c) 2020, Kai Wolf. All rights reserved.
from argparse import ArgumentParser
capital_gains_tax = 0.26375
def calculate_profit(quantity, buy_price, sell_price):
gain = quantity * sell_price - quantity * buy_price
fees = min(69.9, 4.9 + sell_price * 0.25) # ING-DiBBa order provision
taxes = (gain - fees) * capital_gains_tax
@NewProggie
NewProggie / keybase.md
Created August 15, 2016 15:06
keybase.md

Keybase proof

I hereby claim:

  • I am NewProggie on github.
  • I am newproggie (https://keybase.io/newproggie) on keybase.
  • I have a public key whose fingerprint is E6F6 759C 2E2F 9E84 8FCE 55CA 69DC 6C3B 6D49 6F4A

To claim this, I am signing this object:

#include <algorithm>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
struct HashString {
void operator()(const std::string &s) {
#include <cstdint>
class Device {
public:
Device() {}
bool write8(uint8_t page, uint8_t addr, uint8_t v) {
return true;
}
bool write16(uint8_t page, uint8_t addr, uint16_t v) {
return true;
#pragma once
#include <string>
#include <unordered_map>
#include <vector>
#include <cstdint>
#include <iostream>
namespace smart_enum
{
inline std::string trimWhitespace(std::string str)
@NewProggie
NewProggie / adjacent_pair.cpp
Created May 19, 2016 09:13
Process for each adjacent pair in collection
#include <iostream>
#include <vector>
// process for each adjacent pair in collection:
// [2, 3, 5, 7, 9] ==> f(2, 3), f(3, 5), f(5, 7), f(7, 9)
template <typename Iter, typename Func>
void adjacent_pair(Iter first, Iter last, Func f) {
auto trailer = first;
first++;
while (first != last) {
@NewProggie
NewProggie / grep_source.sh
Created December 7, 2015 09:21
Grep sourcecode for words beginning with cv:: (or std:: or whatever)
grep -r src/ -e "cv::[a-zA-Z]*" -o | cut -d ':' -f2,3,4 | sort | uniq
@NewProggie
NewProggie / qrcodegen.sh
Created January 9, 2015 08:39
Create qr codes with consecutive numbering and labels
#!/usr/bin/env bash
NUM_QR_CODES=80
DPI=300
TMP_DIR=qrtemp
W_GRID=$(echo "scale=0; sqrt(${NUM_QR_CODES}/sqrt(2))" | bc -l)
H_GRID=$(echo "scale=0; ${NUM_QR_CODES}/${W_GRID}" | bc -l)
# install dependencies
sudo apt-get -y install qrencode imagemagick