Skip to content

Instantly share code, notes, and snippets.

@Moelf
Moelf / numpy_is_absurr.md
Last active January 24, 2024 22:29
Numpy is absurd.

Numpy is absurd

HN Discussion

I always gripe about Python not having useful (i.e. performant and with adoption) built-in array type and Numpy doesn't distinguish "vector of vector" from "matrix", but this still surprised me.

in is actually intersect?

It seems that Numpy uses intersect logic to check a in b:

@thecarlhall
thecarlhall / 0-scrape_api.sh
Created June 8, 2020 01:32
Scripts to check the API implementation of Gonic
#!/usr/bin/env bash
curl http://www.subsonic.org/pages/api.jsp | \
grep -A 4 '<h3' | \
grep -e '<h3' -e Since | \
tail -n +6 | tr -d "\r\n" | \
sed -e $'s/<h3>/\\\n/g' | \
sed 's/<[^>]*>//g' | \
awk '{print $3, $1}' | \
sort -V > api-by-version.csv
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active April 17, 2024 01:21
Hyperlinks in Terminal Emulators
@Nervengift
Nervengift / rofi-pulse-sink.sh
Last active August 10, 2022 08:30
Choose pulseaudio sink via rofi/dmenu
#!/usr/bin/bash
# choose pulseaudio sink via rofi or dmenu
# changes default sink and moves all streams to that sink
sink=$(ponymix -t sink list|awk '/^sink/ {s=$1" "$2;getline;gsub(/^ +/,"",$0);print s" "$0}'|rofi -dmenu -p 'pulseaudio sink:' -location 6 -width 100|grep -Po '[0-9]+(?=:)') &&
# alternate version using dmenu:
# sink=$(ponymix -t sink list|awk '/^sink/ {s=$1" "$2;getline;gsub(/^ +/,"",$0);print s" "$0}'|dmenu -p 'pulseaudio sink:'|grep -Po '[0-9]+(?=:)') &&
ponymix set-default -d $sink &&
for input in $(ponymix list -t sink-input|grep -Po '[0-9]+(?=:)');do
@dwgill
dwgill / mpvctl
Last active January 25, 2023 02:00
A small script for controlling mpv via the JSON IPC. Intended to resemble playerctl.
#!/usr/bin/env bash
# This script requires:
# - that the directory $HOME/.mpv exist
# - that the program socat be installed
# - that you start mpv with the unix socket feature pointing at that directory
# I recommend an alias in your .bashrc or equivalent file:
# alias mpv="mpv --input-unix-socket=$HOME/.mpv/socket"
socket="$HOME/.mpv/socket"
@jokey2k
jokey2k / sshfilter.sh
Last active March 5, 2024 12:30
Tuned version of sshfilter.sh to allow for ipv6 filtering
#!/bin/bash
# based on script from http://www.axllent.org/docs/view/ssh-geoip
# License: WTFPL
# UPPERCASE space-separated country codes to ACCEPT
ALLOW_COUNTRIES="DE EU GB"
LOGDENY_FACILITY="authpriv.notice"
if [ $# -ne 1 ]; then
echo "Usage: `basename $0` <ip>" 1>&2

Moved

Now located at https://github.com/JeffPaine/beautiful_idiomatic_python.

Why it was moved

Github gists don't support Pull Requests or any notifications, which made it impossible for me to maintain this (surprisingly popular) gist with fixes, respond to comments and so on. In the interest of maintaining the quality of this resource for others, I've moved it to a proper repo. Cheers!

@Soft
Soft / keys
Created May 6, 2011 15:39
More vim like ncmpcpp keys config
key_move_song_up = 'K'
key_move_song_down = 'J'
key_next_found_position = 'n'
key_prev_found_position = 'N'
key_prev_column = 260 'h'
key_next_column = 261 'l'
key_lyrics = '.'
key_home = 262 'g'
key_end = 360 'G'