Skip to content

Instantly share code, notes, and snippets.

@hacst
hacst / line-canvas-test.html
Last active August 29, 2015 14:14
Test Canvas based animation of a signal on a line
<html>
<style>
body {
}
#canvas {
width: 100%;
height: 100%;
margin: 0px;
}
@hacst
hacst / enum_class_generation_issue.i
Created July 15, 2015 21:34
Basic test case for SWIG code generation producing valid code not accepted by MSVC
%module EnumClassGenerationIssue
%include <std_vector.i>
%inline {
enum class TestEnum {};
}
%template(TestEnumVector) std::vector<TestEnum>;
@hacst
hacst / CMakeLists.txt
Created June 5, 2018 23:18
Basic Systemd sd_notify + watchdog usage
cmake_minimum_required(VERSION 2.8)
project(sdnotify)
add_executable(sdnotify sdnotify.cpp)
target_link_libraries(sdnotify PUBLIC systemd)
@hacst
hacst / pinout.txt
Created November 24, 2018 10:06 — forked from castleberrysam/pinout.txt
GPIO connections for BYK870 based keyboards (WIP)
rows and column numbers start at the bottom left
P0.2: USB pin D+
P0.3: USB pin D-
P0.4: USB pin D+ pulldown (used during reset)
P2.0: USB pin D- pullup (used during reset)
P0.5: switch row 6 drive
P0.6: switch row 5 drive
P0.7: switch row 4 drive
@hacst
hacst / byk8xx.cpp
Created November 24, 2018 10:06 — forked from castleberrysam/byk8xx.cpp
Some reverse engineered C++ code from the BYK8xx firmware update utility
#include <stdio.h>
extern char *fw_data;
extern int fw_len;
// used to hold the RunOnlyOneUpdateTools mutex
extern HANDLE dword_458908;
// used to hold the first byte pair after the firmware header
extern int dword_45868c;
@hacst
hacst / hibp.py
Created January 17, 2019 20:24
Small python console script to check whether your password has been leaked to https://haveibeenpwned.com/ . See https://haveibeenpwned.com/API/v2#SearchingPwnedPasswordsByRange on why this is safe to do and you aren't leaking your password by checking.
#!/usr/bin/env python3
from hashlib import sha1
from getpass import getpass
from requests import get
def is_pwd_pwned(pwd):
""" Returns tuple of (pwned:boolean, occurances) for given password"""
h = sha1(pwd.encode('utf-8')).hexdigest().upper().encode('ascii')
prefix_h = h[:5]
suffix_h = h[5:]