A bash script that turns mpv into a radio.
- mpv: to play the stream
- dmenu: to choose radio stations
- jq: to parse IPC responses from mpv
#!/bin/bash | |
# initialize a fifo file to control what station mpv is playing | |
MPVFIFO=$HOME/.radio/mpv | |
if [[ ! -p $MPVFIFO ]]; then | |
mkfifo $MPVFIFO | |
fi | |
# select the radio station to start playing | |
STATION_NAME=$(cat .radio/stations | awk -F ',' '{print $1}' | dmenu -p 'Choose station:') |
An experiment doing n-gram similarity. | |
Usage: | |
`$ python trigram.py '<left string>' '<right string>' <number of letters in a gram>` | |
Example: | |
``` | |
$ python trigram.py 'hello' 'hallo' 3 |
A tactic for managing long lived goroutines by handing them a "life" token. | |
The goroutines can check if the token "is dead" and quit while signalling that they have quit. | |
See `main.go` for an example usage. |
Quick Demo of Python Memory Profiling |
Tmux Script for Active Server Monitoring |
Using linux dlls in python. | |
1. `make` | |
2. `python main.py` |
def row_diff(rows, column_position): | |
""" | |
gets the difference between 2 row values | |
""" | |
# the column position parameter starts to count from 1 | |
# so have to make it start counting from 0 | |
column_position = column_position - 1 | |
results = [] | |
prev_value = None |