Skip to content

Instantly share code, notes, and snippets.

View neaxi's full-sized avatar
🤷‍♂️

neaxi

🤷‍♂️
  • @cyberspace
View GitHub Profile
@neaxi
neaxi / rules_to_problem_solving.md
Created June 5, 2023 08:03
Rules to problem solving

Rules to Problem Solving

(Unknown author)

Rule #1: Don't assume you understand the problem

This is one of the classic mistakes of problem solving - you think you understand what's going on, but you didn't look deep enough or get enough information to really get it. Before starting to solve any problem, be sure you spend some time and be absolutely sure you understand exactly what's going in.

Rule #2: Don't assume that the person who reported the problem understands the problem either

@neaxi
neaxi / CH9325.md
Last active April 3, 2022 16:34
UT-D04 driver - WCH_CH9325

Intro

UT-D04 cable refused to connect and therefore I was unable to collect data via USB from my UNI-T multimeter. The cable worked with previous instance of Win10 and still works when used under VirtualBox'ed Windows XP, so hardware failure was ruled out.

After quick internet search, drivers were the suspect.
https://community.element14.com/technologies/test-and-measurement/b/blog/posts/uni-t-dmm-usb-adapter-compatibility-with-windows-10
this USB interface appears to be compatible only with Windows, including software to read and acquire data. The most serious thing is that the available drivers are compatible only up to Windows 7 and I have not been able to find a way to make the device recognized by Windows 10

How to fix

Windows 10 seems to have multiple drivers for CH9325 USB interface chip. Look for a device with VID/PID 1A86:E008

@neaxi
neaxi / csv_to_ics_birthday_generator.py
Last active October 2, 2023 15:01
.csv to .ics (iCal) birthday event generator
'''
What:
Creates an .ics file with iCal events based on birthdays loaded
from a .csv file with each line formatted as YYYY-MM-DD,Name
Each entry has current age added to the name of the event.
How to use it:
Change the input filename specified in DATA_SOURCE.
YEARS_AHEAD constant specifies how many years of events are to be generated.
'''

Related to Raspberry Pi - Auto WiFi Hotspot Switch

Issue 01 - \r\n newlines and awk ORS

I've noticed the issue when examining /var/log/syslog and also the uap0 was bouncing back and forth from the ifconfig.

The issue

/usr/bin/autohotspot script checks for existing SSIDs in /etc/wpa_supplicant/wpa_supplicant.conf and starts the hotspot only if they are not connected.
Currently configured SSIDs are parsed out of the config using following line:
wpassid=$(awk '/ssid="/{ print $0 }' /etc/wpa_supplicant/wpa_supplicant.conf | awk -F'ssid=' '{ print $2 }' ORS=',' | sed 's/\"/''/g' | sed 's/,$//')

@neaxi
neaxi / raspi_hdmi.sh
Created September 30, 2020 20:40
RasPi - Turn HDMI on or off based on current state
# if the status contains "TV is off", turn it on
# otherwise turn it off
# /opt/vc/bin/tvservice -s | grep "TV is off" > /dev/null && /opt/vc/bin/tvservice -p || /opt/vc/bin/tvservice -o
# tvservice leaves blank screen without refresh
# https://www.raspberrypi.org/forums/viewtopic.php?t=249308
# workarounds:
# a) use `fbset -depth 8 && fbset -depth 16` after turning on the display
@neaxi
neaxi / gist:9425f1b5ff99eacfba08fa9ce70f1544
Created January 1, 2020 11:22
Touch UI display rotation
0. SOURCES
https://github.com/BillyBlaze/OctoPrint-TouchUI/wiki/Setup:-Troubleshooting#calibration
https://wiki.ubuntu.com/X/InputCoordinateTransformation
1. SET DISPLAY ROTATION
$ cat /boot/config.txt
display_rotate=3
2. TOUCHSCREEN ROTATION
$ cat ~/TouchUI-autostart/calibration.sh