Skip to content

Instantly share code, notes, and snippets.

Avatar
🐺
C/C++/Linux ░▒▓▉▊▋▌▍▎▏

Juuso Alasuutari imaami

🐺
C/C++/Linux ░▒▓▉▊▋▌▍▎▏
View GitHub Profile
@imaami
imaami / headless_install_cuda_in_wine.md
Created Jul 13, 2020
Installing CUDA Toolkit 10.2 in Wine without a GUI
View headless_install_cuda_in_wine.md

Installing CUDA Toolkit 10.2 in Wine

Steps

  1. Set and export shell variables

    Use a helper variable for the prefix name:

    MYPREFIX=cudatest
@imaami
imaami / headless_install_cmake_in_wine.md
Last active Jul 13, 2020
Installing CMake for Windows in Wine without a GUI
View headless_install_cmake_in_wine.md

Installing CMake for Windows in Wine without a GUI

Steps

  1. Set and export shell variables

    These variables are for our convenience:

    MYPREFIX=cmaketest
@imaami
imaami / trick_tty.c
Created Jul 5, 2020
Trick programs into thinking they're piping to an interactive terminal
View trick_tty.c
/**
* Overrides the glibc function. Will always return true.
*
* Note: Although this should be ok for most applications it can
* lead to unwanted side effects. It depends on the question
* why the programm calls isatty()
*
* Compiling
*
* $ gcc -s -fpic -shared -o libtricktty.so trick_tty.c
@imaami
imaami / do-cpupower.sh
Created Apr 2, 2020
cpupower frequency monitoring
View do-cpupower.sh
#!/bin/bash
clear
while z="$(cpupower monitor -i .3333 -m Mperf)"; do
echo $'\e'"[0;0H$z"
done
@imaami
imaami / foldingathome-webui
Created Mar 17, 2020
Launch a fresh Folding@home web control UI
View foldingathome-webui
#!/bin/sh
#
# The Folding@home Web Control UI seems to bug out
# frequently (at least on Chrome). It'll go into a
# page refresh loop from which it will not recover
# until the browser cache is cleared manually.
#
# This script launches a fresh Chrome window using
# app mode and incognito to eliminate any leftover
# cached data. If the UI bugs out, just ctrl-w the
@imaami
imaami / git_log_format_patch.sh
Created Feb 5, 2020
`git format-patch` output from `git log --pretty=format:...`
View git_log_format_patch.sh
#!/bin/bash
#
# Doesn't print the content of the actual diff yet.
# Probably fails to produce identical output in some
# cases.
#
git log --pretty='format:From %H%nFrom: %an <%ae>%nDate: %aD%nSubject: [PATCH] %s%n%n%b%n' "$@"
@imaami
imaami / temperature_data.sh
Created Feb 2, 2020
Quick & dirty script that prints thermals from /sys
View temperature_data.sh
#!/bin/bash
for f in $(find /sys/ | grep -E '/temp[0-9]+_input'); do
t="${f%_input}_type"
l="${f%_input}_label"
if [[ -e $t ]]; then
t=$(<$t)
else
t=' '
fi
@imaami
imaami / video_frame_times.sh
Created Dec 30, 2019
Get frame indices + timestamps from video file.
View video_frame_times.sh
#!/bin/bash
#
# Extract list of zero-based frame indices with timestamps.
#
ffprobe -v error -show_entries frame=pkt_pts_time \
-select_streams v -of csv=p=0 "$1" | grep -n '^' \
| while read L; do
i="${L%%:*}"
echo "$((i-1)):${L#*:}"
@imaami
imaami / 99-usb-serial-screen.rules
Created Nov 5, 2019
Automatically launch urxvt serial consoles
View 99-usb-serial-screen.rules
#
# /etc/udev/rules.d/99-usb-serial-screen.rules
#
ACTION!="add", GOTO="usb_serial_screen_end"
KERNEL!="ttyUSB[0-9]*", GOTO="usb_serial_screen_end"
SUBSYSTEM!="tty", GOTO="usb_serial_screen_end"
# List of USB serial devices for which to launch a terminal
ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", GOTO="usb_serial_screen_run"
View HOME_local_lib_git_find
#!/bin/bash
#
# Save this script as $HOME/.local/lib/git/find (make sure it's
# executable), then add a git alias:
#
# $ git config --global alias.find '!$HOME/.local/lib/git/find'
#
T="$(git rev-parse --show-toplevel)"
[[ -z "$T" ]] || T="$T/"
You can’t perform that action at this time.