Skip to content

Instantly share code, notes, and snippets.

View CTXz's full-sized avatar

Patrick Pedersen CTXz

  • Technische Universität Berlin
  • Berlin
View GitHub Profile
#!/usr/bin/env python3
# Copyright (C) 2023 Patrick Pedersen, TUDO Makerspace
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
@CTXz
CTXz / gowin_qt4.conf
Created January 25, 2023 15:05
Custom QT4 conf file to ensure the Gowin FPGA IDE doesn't have theme issues. For this config to work, the following patch must be applied to the libQtGui.so.4 binary first: https://gist.github.com/CTXz/23042d54f8899a5271a0761aba3d898f. For a full-on automated script that patches and applies the theme, please see https://gist.github.com/CTXz/788b…
[Qt]
Palette\active=#4c4c4c, #f2f1f0, #ffffff, #f8f8f7, #797878, #a1a1a0, #3c3c3c, #ffffff, #4c4c4c, #ffffff, #f2f1f0, #000000, #87a752, #ffffff, #acc089, #87a752, #efefef, #000000, #ffffdc, #ffffff
Palette\inactive=#4c4c4c, #f2f1f0, #ffffff, #ffffff, #797878, #a1a1a0, #3c3c3c, #ffffff, #4c4c4c, #ffffff, #f2f1f0, #000000, #87a752, #ffffff, #acc089, #87a752, #efefef, #000000, #ffffdc, #000000
Palette\disabled=#808080, #f2f1f0, #ffffff, #ffffff, #797878, #a1a1a0, #808080, #ffffff, #808080, #ffffff, #f2f1f0, #000000, #87a752, #808080, #acc089, #87a752, #efefef, #000000, #ffffdc, #ffffff
@CTXz
CTXz / gowin-ide-fix-theme.sh
Last active April 5, 2023 10:16
Patches the libQtGui.so.4 library to ignore system themes and thus fixes akward theme issues with the Gowin FPGA IDE on Linux.
#!/usr/bin/env bash
#
# Copyright (C) 2023 Patrick Pedersen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@CTXz
CTXz / gowin-ide-libQtGui-custom-conf.patch.hex
Last active January 24, 2023 14:19
Patches the local libQtGui.so.4 lib of the Gowin FPGA IDE to allow independent theming via a gowin_qt4.conf file instead of using ~/.config/Trolltech.conf. This can be used to fix akward theme related issues such as unreadable text etc.
00000000: 4253 4449 4646 3430 3600 0000 0000 0000 BSDIFF406.......
00000010: 4c00 0000 0000 0000 a0ac ae00 0000 0000 L...............
00000020: 425a 6839 3141 5926 5359 9f6a 31ce 0000 BZh91AY&SY.j1...
00000030: 0770 5040 2402 0000 2040 0040 0520 0031 .pP@$... @.@. .1
00000040: 064c 40d0 c468 a600 0a67 7a78 bb92 29c2 .L@..h...gzx..).
00000050: 8484 fb51 8e70 425a 6839 3141 5926 5359 ...Q.pBZh91AY&SY
00000060: 0bd6 5bb7 0057 ae64 15d0 4428 0001 0004 ..[..W.d..D(....
00000070: 0000 0400 0800 0a20 0050 81a0 6809 aaa0 ....... .P..h...
00000080: 184d 5029 4b3c 0228 58e8 4aa1 556e de37 .MP)K<.(X.J.Un.7
00000090: ddac f244 825a dfe2 ee48 a70a 1201 7acb ...D.Z...H....z.
#!/usr/bin/env bash
# Installation and fix script for ModelSim 16.1 on Ubuntu 22.04
# Author: Patrick Pedersen <ctx.xda@gmail.com>
# Date: 2023-01-17
# NOTE: This script has been developed for- and tested on Ubuntu 22.04
# It may or may not work on other distributions
# Usage:
@CTXz
CTXz / bpi-m2z-gpio-setup.sh
Last active January 23, 2024 02:22
An installation script that sets up GPIO functionality for the Banana Pi M2 Zero. It installs prerequired packages, necessary system files, a Banana Pi M2 Zero compatible port of WiringPi and a Banana Pi M2 Zero compatible port of RPi.GPIO.
#!/usr/bin/env bash
#
# Copyright (C) 2023 Patrick Pedersen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#

Banana Pi M2 Zero Starter

Welcome to this little guide I made myself to quickly get stared with Banana Pi M2 Zero projects!

At the end of the guide you should have a headless Banana Pi M2 Zero set-up with wiringPi and RPi.GPIO support.

Special thanks to TuryRx's Banana Pi M2 Zero GPIO guide, as most steps to get GPIOs working here were directly taken from their extensive guide.

Headless Armbian Set-Up

@CTXz
CTXz / midi_notes.h
Last active February 6, 2024 17:59
C header that contains defines for all midi notes
/*
* Copyright (C) 2024 Patrick Pedersen
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@CTXz
CTXz / FixSamples.py
Created July 30, 2022 00:37
This script saved my 5 hour long recording of DJ sets at an event, bless it!
# This script saved my 5 hour long recording of DJ sets at an event, bless it!
# The recording was likely flawed due to a sampling rate missmatch between the interface and
# the recording software. The result was a recording that had a faulty sample or two
# every 48 samples. The audible effect of this is that the recording had a high pitched
# "bit-cursh-ish" sound.
# To fix the recordings, the script applies a linear interpolation every 48 samples
# (where the faulty samples are). While a linear interpolation isn't the most accurate
# interpolation method to restore audio, it actually suffices for errors of so few samples.

Preparation

Download this ESP8266 toolchain to ~/esp8266:

$ git clone https://github.com/gschorcht/RIOT-Xtensa-ESP8266-toolchain.git ~/esp8266

Install the required dependencies for ColorChord: