Skip to content

Instantly share code, notes, and snippets.

View rogerdahl's full-sized avatar

Roger Dahl rogerdahl

  • edirepository.org
  • Albuquerque, New Mexico, USA
View GitHub Profile
@Hermann-SW
Hermann-SW / flash
Last active July 24, 2023 19:01
"Flash .uf2 file to"/reboot Raspberry Pico with baudrate switching method [+picotool reboot]
#!/bin/bash
sudo stty -F /dev/ttyACM0 1200
echo waiting
while [ ! -d /media/pi/RPI-RP2 ]; do sleep 0.1; done
sleep 0.5
if [ "$*" = "" ]; then echo rebooting; sudo picotool reboot; exit; fi
echo copying
cp $1 /media/pi/RPI-RP2
echo done
@kabbi
kabbi / uwatch2-protocol.md
Last active March 13, 2020 12:11
Umidigy uwatch2 ble protocol reverse engineering notes

Packet format

0xfe - start byte
0xea - some kind of protocol version
0x10 - some kind of protocol version
1 byte of packet length, payload length + 4
variable length payload
@jan-warchol
jan-warchol / sync-history.sh
Last active February 4, 2024 04:52
Synchronize history across bash sessions
# Synchronize history between bash sessions
#
# Make history from other terminals available to the current one. However,
# don't mix all histories together - make sure that *all* commands from the
# current session are on top of its history, so that pressing up arrow will
# give you most recent command from this session, not from any session.
#
# Since history is saved on each prompt, this additionally protects it from
# terminal crashes.
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active June 28, 2024 08:56
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'