Skip to content

Instantly share code, notes, and snippets.

View iwanders's full-sized avatar

Ivor Wanders iwanders

  • 01:00 (UTC -04:00)
View GitHub Profile
@iwanders
iwanders / hextool.py
Last active August 28, 2023 21:43
Hextool: commandline utility to convert hex, binary and decimal.
#!/usr/bin/env python3
def example_print(call, fun, input, desc):
inputs = "{}({:})".format(call, repr(input))
outputs = "{:>8s}".format(repr(fun(input)))
print("{: <30s} -> {: >30s} {:s}".format(inputs, outputs, desc))
input_byte = 0x3D
input_list = [0x38, input_byte]
input_text = [0x68, 0x65, 0x6c, 0x6c, 0x6f]
@iwanders
iwanders / compile_time_crc.hpp
Created June 26, 2018 01:09
C++ Compile Time CRC32
/*
The MIT License (MIT)
Copyright (c) 2018 Ivor Wanders
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@iwanders
iwanders / README.md
Last active January 6, 2017 18:55
Bluetooth link key from Toshiba Bluetooth Stack in Windows 7

Bluetooth link key from Toshiba Bluetooth Stack

When multibooting Windows and Ubuntu you continuously have to repair your Bluetooth devices in order to use them. This is because during the pairing process the link-key is created. This key is to be associated with a specific MAC adress. This causes problems as the Bluetooth stack in Ubuntu and Windows have separate keys but use the same MAC adress (same bluetooth hardware to communicate to the device).

In my case this caused a Bluetooth-enabled headphone to be either paired with Windows or with Ubuntu. But never with both at the same time.

If the same key were to be used in both operating systems this problem can be solved. If the standard Windows Bluetooth Stack is used a description is here: finding-bluetooth-link-key-in-windows-7-to-double-pair-a-device-on-dualboot-com.

For the said headphone I am required

@iwanders
iwanders / pull_from_phone.py
Created January 16, 2016 15:17
android_pull_photos
#!/usr/bin/env python3
"""
Simple command line tool to pull photos from an Android phone using ADB.
Puts the files into monthly folders and deletes files from the phone that
are older than 30 days.
"""
import subprocess
@iwanders
iwanders / teensy_input_voltage_analysis.py
Last active August 29, 2015 14:09
[Teensy] Script used to relate analogRead(39) with input voltage.
#!/usr/bin/env python2
"""
Script to relate Teensy 3.0 analogRead(39) values to the input voltage.
That's the original purpose atleast, it could probably be used to create
polynomials for any file in which holds measurements of: "x y" per line.
Datafiles included here:
https://gist.github.com/iwanders/44671b3cf09afe390d3e