Skip to content

Instantly share code, notes, and snippets.

View korjaa's full-sized avatar

Jaakko Korhonen korjaa

View GitHub Profile
import wave
import pyaudio # pip install pyaudio
# Initialize
audio = pyaudio.PyAudio()
stream = audio.open(format=pyaudio.paInt16,
channels=1,
rate=44100,
input=True,
frames_per_buffer=1024)
@korjaa
korjaa / install_build_opencv.txt
Last active January 21, 2019 18:53
Installing OpenCV to Windows Bash
# http://www.harrysmemo.com/post/152444507227/installing-opencv3-on-bash-on-windows
sudo apt-get update -y
sudo apt-get install -y build-essential cmake
sudo apt-get install -y zlib1g-dev libjpeg-dev libwebp-dev libpng-dev libtiff5-dev libjasper-dev libopenexr-dev libgdal-dev
sudo apt-get install -y libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev yasm libopencore-amrnb-dev libopencore-amrwb-dev libv4l-dev libxine2-dev
sudo apt-get install -y libtbb-dev libeigen3-dev
git clone https://github.com/opencv/opencv.git
cd opencv
@korjaa
korjaa / openocd.sh
Created April 4, 2019 12:28
OpenOCD server
# Start GDB server
openocd -f /usr/share/openocd/scripts/board/st_nucleo_f4.cfg -c init -c "reset init"
@korjaa
korjaa / mbed_trace_remove_color.c
Created June 10, 2019 07:04
mbed_trace remove color.
mbed_trace_config_set(mbed_trace_config_get() & ~TRACE_MODE_COLOR);
@korjaa
korjaa / cool-retro-term-setup.sh
Last active August 22, 2019 09:54
cool-retro-term
# Install fromm Ubuntu Software Center
# Add following to ~/.bashrc
# Cool Retro Term doesn't properly identify as a 256 color terminal.
# Force it to identify as xterm-256color instead of just xterm.
[ -z "$COLORSCHEMES_DIR" ] || export TERM='xterm-256color'
@korjaa
korjaa / gist:059127ad9c65cf0d71943c040fd989d7
Created September 17, 2019 14:25
MAF MAP Fuel Consumption
From: http://www.mp3car.com/vbulletin/engine-management-obd-ii-engine-diagnostics-etc/75138-calculating-mpg-vss-maf-obd2.html
For the record, the first "one-line" MPG formula above, taken from
my Circuit Cellar article, is off by 100! The "4.54" should in
fact be "454". The correct formula is:
MPG = (14.7 * 6.17 * 454 * VSS * 0.621371) / (3600 * MAF / 100) MPG
= 710.7 * VSS / MAF
@korjaa
korjaa / factorio_red_circuit_15s.txt
Created January 26, 2020 10:02
Factorio - Red Circuit board 15/s
0eNqsvd2OJUeSpPkuvK4ouP2b9asMBgsWi8NOgM0kksnBNhr97hvFYmQeslxOyCe9V0T9UEJNVc3cj7iY6H9987cff/3+508ffvr8zb/91zcfvvv40y/f/Nv/+q9vfvnww0/f/viP/+7zf/78/Tf/9s2Hz9//xzd/+eanb//jH//p27//329/+u77v7989+HTd79++PzNf//lmw8//f37//ebfyv//Zebf/3/fvj0+dfX/+YLwj//Hy/14d+s//2///LN9z99/vD5w/f/jOK3//Cf/89Pv/7H377/9Ar95d/+/Onbn375+eOnzy9/+/7Hz6+oP3/85fVf+/jTP/7kK9RLbX/55j9f/7nnK/7fP3z6/rt//q/1H9H9CbYGsOO/b4AaACp+fB3AVh92+LDl+LATRHv5sCuIdvwRdt7A7iDaP8H2G9gDol1+EsoFcDfALQGukd1Sgzw4uGCnlQHyALZamQB3BLhOHmaQBweX7DZw0haw3f5RCxv3BLhGHuoV5MHBJfsNPCkq2W/gUVFbEK+Thx7E6+CC/QYebZVsN/BsqyvAddKweRocWLDbwMOtgc0Gnm2t8GiNJLTKo3VgwU4DD7YGNhp4rrXBo3WSMHm0DizYZuAh0cAuA8+Idjis82Pi4klwYMkTzU9CJ7/NAGzj0TpJ6DxaB9bfZSS1/iYDj5y+cKxOBjaO1UH1dxjoreFvMHAajIJRHQqg4gw4qP7uAg+F4W8ucHiPgWN1MjBxrA6qv7fAU3H4ewu8Ho2DUR1u6cIZcFD9vQXekqe/t8D74Ww4VicDHcfqoILnFuDW5uSw04AFT67yjAWemwM52fR3FPlpv/wtRZie9XVPffvLL9//x99+/PDTDy//8e13//7hp+9fyg3424Z9rc03r9Affvts8N3Hn3/+/tPLd9/+7cfvv7n7M/4mIzzg8ncZoamWv80Iu7jAPgOH7QL77Pj7bC0Oa5wKC+w6cIatA/v4yxcY1Mf7Cr5B9bvTZycfydotUg2+jbT3K7VbgNs
@korjaa
korjaa / gnuplot.plt
Last active October 7, 2021 09:39
Gnuplot spells
# Defaults
# ==========
set grid
set datafile separator ","
set print "-" # enable logging
print "Hello world"
set autoscale fix # Axes tight
# CSV column headers
# ====================
@korjaa
korjaa / bash.sh
Last active May 18, 2022 06:11
Bash snippets.
#
# Loops
#
# Loop files with weird names and reading from console stdin.
while IFS= read -r -d $'\0' FILE; do
read -p "Press Enter to continue to \"$FILE\"" </dev/tty
done < <(find . -printf "%P\0" | grep --null-data "filter")
# Loop files with less surprises
@korjaa
korjaa / buildroot.rst
Last active May 26, 2022 14:34
Buildroot & QEMU notes

Buildroot & QEMU

Navigating menuconfig

  • Search with /
  • Jump with 1

Building Commands