This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# the metadata only contains the name of the default sink | |
default_sink_name=$(pw-metadata 0 'default.audio.sink' | grep 'value' | sed "s/.* value:'//;s/' type:.*$//;" | jq .name) | |
default_sink_id=$(pw-dump Node Device | jq '.[].info.props|select(."node.name" == '" $default_sink_name "') | ."object.id"') | |
current_volume=$(pw-cli enum-params "$default_sink_id" 'Props' | grep -A 2 'Spa:Pod:Object:Param:Props:channelVolumes' | awk '/Float / {gsub(/.*Float\s/," "); print $1^(1/3) }') | |
change="${1:-0.1}" # defaults to increment of 0.1 | |
new_volume=$(echo "$current_volume $change" | awk '{printf "%f", $1 + $2}') | |
# we need to reconvert to cubic root | |
#new_volume_cube=$(echo "$new_volume" | awk '{ print $1^3 }') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
print "MASTER\tSLAVES\n"; | |
my $pid = -1; | |
for my $master_end (qx#lsof -F pcf /dev/ptmx#) { | |
chomp $master_end; | |
if ($master_end =~ /p.*/) { | |
print "\n" if $pid>0; | |
$pid = substr($master_end, 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> | |
<fontconfig> | |
<description>Make Windows Font Look Good</description> | |
<match target="font"> | |
<edit name="iswindowsfont" mode="assign"> | |
<or> | |
<eq> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function conv_to_uni(st) { | |
udata = {"66":["7470","8492","9399","119809","119861","119913","120017","120069","120121","120173","120225","120277","120329","120381","120433","127281","65314"],"87":["7490","9420","119830","119882","119934","119986","120038","120090","120142","120194","120246","120298","120350","120402","120454","127302","65335"],"77":["7481","8499","8559","9410","119820","119872","119924","120028","120080","120132","120184","120236","120288","120340","120392","120444","127292","65325"],"69":["7473","8496","9402","119812","119864","119916","120020","120072","120124","120176","120228","120280","120332","120384","120436","127284","65317"],"90":["8484","8488","9423","119833","119885","119937","119989","120041","120197","120249","120301","120353","120405","120457","127305","65338"],"98":["7495","9425","119835","119887","119939","119991","120043","120095","120147","120199","120251","120303","120355","120407","120459","65346"],"117":["7512","7524","9444","119854","119906","119958","120010","120062", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# fetch the new block list | |
wget 'https://v.firebog.net/hosts/lists.php?type=all' -O list_all | |
# reset the old hosts directory | |
rm -r all_hosts | |
mkdir all_hosts | |
# read the file and download into the all_hosts directory | |
while read a; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" -lt 2 ]; then | |
echo "Usage: $0 dir text" >&2 | |
exit 1 | |
fi | |
# 1275x1650 - the size of the A4 images | |
dir=$1 | |
text=$2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" -lt 1 ]; then | |
echo "Usage: $0 pdfs" >&2 | |
exit 1 | |
fi | |
for pdf in "$@" | |
do | |
echo "Converting $pdf to images" | |
pages="$( pdfinfo "$pdf" |grep Pages | sed -e 's/Pages:\( \)\+//')" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" -lt 2 ]; then | |
echo "usage: ${0} <extension> <replace>" | |
exit 1 | |
fi | |
for f in *.${1} | |
do | |
newname="${f%${1}}${2}" |