Skip to content

Instantly share code, notes, and snippets.

View usptact's full-sized avatar

Vladislavs Dovgalecs usptact

View GitHub Profile
@usptact
usptact / wif.md
Created July 11, 2023 08:28 — forked from t4sk/wif.md
How to convert private key to WIF

How to convert private key to WIF

0. Overview

WIF = base58check encode ([version byte][private key][checksum])

version byte = 80 for mainnet, ef for testnet and regtest

checksum = first 4 bytes of double SHA256 of private key
@usptact
usptact / gist:ecbea82c6e2742461fbb0c27a58437f5
Created July 25, 2023 06:43
Do "git pull" in every git repo
$ find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && git pull" \;
@usptact
usptact / ssh agent refused operation
Created January 16, 2024 19:57
Could not add card "/usr/lib/opensc-pkcs11.so": agent refused operation
System: MacOS Sonoma 14.1.2
First, try to unplug and plug back the Yubikey.
Second, try rebooting the system.
Make sure `opensc` package is up to date. I am using Macports to install utilities/libraries and other command-line utils.
```
$ sudo port upgrade opensc
```
@usptact
usptact / gst-tee.txt
Last active March 14, 2025 04:12
GStreamer: read a stream from video camera and use tee to (a) show the stream on display and (b) write to a file
$ gst-launch-1.0 -e v4l2src device=/dev/video0 do-timestamp=true ! 'video/x-raw, width=640, height=480, framerate=30/1' ! tee name=t \
t. ! queue ! videoconvert ! autovideosink \
t. ! queue leaky=downstream ! videoconvert ! x264enc tune=zerolatency speed-preset=ultrafast key-int-max=30 byte-stream=true ! splitmuxsink muxer=mp4mux location=output.mp4
Notes:
x264enc appears to be not playing nice with streams. Removing its options blocks the pipeline. Replacing it with vaapih264enc works but then splitmuxsink has to be replaced with filesink for some reason...
vaapih264enc enables hardware acceleration on systems with Intel hardware. The plugin is available if you install an extra package: sudo apt install gstreamer1.0-vaapi
from sqlalchemy import create_engine, MetaData, Table, Column, Integer, String, Date, insert, select
import datetime
# Create in-memory SQLite engine
engine = create_engine("sqlite:///:memory:", echo=False, future=True)
# Define table
metadata = MetaData()
cities = Table(
'cities',