Skip to content

Instantly share code, notes, and snippets.

View imaami's full-sized avatar
🐺
C/C++/Linux ░▒▓▉▊▋▌▍▎▏

Juuso Alasuutari imaami

🐺
C/C++/Linux ░▒▓▉▊▋▌▍▎▏
  • Finland
View GitHub Profile
@imaami
imaami / video_frame_times.sh
Created December 30, 2019 17:16
Get frame indices + timestamps from video file.
#!/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 / git_log_format_patch.sh
Created February 5, 2020 11:40
`git format-patch` output from `git log --pretty=format:...`
#!/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 / foldingathome-webui
Created March 17, 2020 12:46
Launch a fresh Folding@home web control UI
#!/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 / do-cpupower.sh
Created April 2, 2020 12:46
cpupower frequency monitoring
#!/bin/bash
clear
while z="$(cpupower monitor -i .3333 -m Mperf)"; do
echo $'\e'"[0;0H$z"
done
@imaami
imaami / headless_install_cuda_in_wine.md
Created July 13, 2020 23:51
Installing CUDA Toolkit 10.2 in Wine without a GUI

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 / team
Created November 7, 2020 16:21
Fix dmenu_run auto-completing "team" -> "teams" instead of "steam"
#!/bin/false
#
# This file exists because i3 really sucks at starting dmenu_run.
#
# Very often when I type mod4+d followed by "steam" and an enter keypress
# the first letter gets dropped (I assume because dmenu_run hasn't captured
# the keyboard yet). What ends up happening is that dmenu_run sees "team"
# and automatically finds the closest match which happens to be "teams".
#
# I almost never fucking want to launch Microsoft Teams, but I launch the
@imaami
imaami / .Xresources
Created December 1, 2020 13:52
Xresources
Xcursor.size: 24
Xft.antialias: true
Xft.rgba: none
Xft.hinting: true
Xft.autohint: true
Xft.hintstyle: full
! black
URxvt*color0: #000000
URxvt*color8: #686868
@imaami
imaami / git-configs.sh
Last active December 7, 2020 12:19
git configuration script
#!/bin/bash
set_git_configs()
{
git config --global pull.ff only
}
set_git_aliases()
{
local -A ALIAS name
@imaami
imaami / headless_install_cmake_in_wine.md
Last active August 31, 2021 09:46
Installing CMake for Windows in Wine without a GUI

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 July 5, 2020 11:59
Trick programs into thinking they're piping to an interactive terminal
/**
* 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