Remove useless utils

Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
This commit is contained in:
Frank Villaro-Dixon 2022-05-31 17:43:02 +02:00
parent 468c281b18
commit 5ab37b92ce
17 changed files with 0 additions and 4103 deletions

View file

@ -1,32 +0,0 @@
#!/bin/bash
file=/dev/shm/btc_stats
fileURL=http://api.bitcoincharts.com/v1/weighted_prices.json
function update_file {
wget --quiet $fileURL -O $file
#echo WILL_WGET
}
if [ -s $file ]; then
#update if older than 1h
age=`stat -c %Y $file`;
now=`date +%s`;
diff=$(($now - $age));
if [ $diff -gt 3600 ]; then
update_file & #Do not hang the result
fi;
#Fucking ugly, but works
content=`cat $file | python -mjson.tool | grep -A3 EUR | tail -n3 | cut -d':' -f2 | cut -d'"' -f2`;
p24h=`echo "$content" | sed -n 1p | cut -d. -f1`
p7d=`echo "$content" | sed -n 3p`
p30d=`echo "$content" | sed -n 2p`
graph=`sparklines $p30d $p7d $p24h`
echo $graph [$p24h] #dont want sparklines newline
else
update_file & #Will surely wait for iface
fi

Binary file not shown.

Binary file not shown.

View file

@ -1,13 +0,0 @@
#!/bin/bash
echo on > /proc/acpi/ibm/light
sleep 0.2
echo off > /proc/acpi/ibm/light
sleep 0.2
echo on > /proc/acpi/ibm/light
sleep 0.2
echo off > /proc/acpi/ibm/light
sleep 0.2
echo on > /proc/acpi/ibm/light
sleep 0.2

View file

@ -1,22 +0,0 @@
#!/bin/bash
window=$(xdotool getactivewindow)
pushd "$(dirname "$0")"
#set -- junk $(cat kaomoji | cut -d '|' -f 1 | dmenu -p emoji)
set -- junk $(cat kaomoji | rofi -dmenu -i | cut -d'|' -f1)
shift
if [ $# -eq 0 ]; then
exit
fi
emoji=$(cat kaomoji | grep "^$(echo $@)|" | cut -d '|' -f 2 | tr -s '\r')
#echo "$emoji" | xclip -selection clipboard
xdotool windowactivate $window
echo -n "$emoji" | xclip -sel clip
xdotool type "$emoji"

View file

@ -1,211 +0,0 @@
#!/usr/bin/env python2
# coding: utf-8
#
# Name : fix-htmldoc-utf8
# Summary: Program to fix UTF-8 characters that HTMLDOC has messed
# Author : Aurelio Jargas www.aurelio.net/soft
# License: BSD
# Release: April, 2008
#
# HTMLDOC has no Unicode support, so when you try to use it in a UTF-8 file,
# all the special characters (not ASCII) will be incorrect in the resulting HTML.
# This program fixes this, restoring the original UTF-8 characters.
#
# Just use it as a filter (reads STDIN, results to STDOUT) or use the -w option
# fix the file in place.
#
# Examples:
# cat myfile.html | fix-htmldoc-utf8 > myfile-ok.html
# fix-htmldoc-utf8 myfile.html > myfile-ok.html
# fix-htmldoc-utf8 -w myfile.html
#
import sys
# You can add new chars to this mapping, if needed.
# The first set are the ISO-8859-1 extended chars.
# The second set are the Unicode chars I've found on my keyboard.
#
mapping = """
¡ &Acirc;&iexcl;
¢ &Acirc;&cent;
£ &Acirc;&pound;
¤ &Acirc;&curren;
¥ &Acirc;&yen;
¦ &Acirc;&brvbar;
§ &Acirc;&sect;
¨ &Acirc;&uml;
© &Acirc;&copy;
ª &Acirc;&ordf;
« &Acirc;&laquo;
¬ &Acirc;&not;
® &Acirc;&reg;
¯ &Acirc;&macr;
° &Acirc;&deg;
± &Acirc;&plusmn;
² &Acirc;&sup2;
³ &Acirc;&sup3;
´ &Acirc;&acute;
µ &Acirc;&mu;
¶ &Acirc;&para;
· &Acirc;&middot;
¸ &Acirc;&cedil;
¹ &Acirc;&sup1;
º &Acirc;&ordm;
» &Acirc;&raquo;
¼ &Acirc;&frac14;
½ &Acirc;&frac12;
¾ &Acirc;&frac34;
¿ &Acirc;&iquest;
À &Atilde;\x80
Á &Atilde;\x81
 &Atilde;\x82
à &Atilde;\x83
Ä &Atilde;\x84
Å &Atilde;\x85
Æ &Atilde;\x86
Ç &Atilde;\x87
È &Atilde;\x88
É &Atilde;\x89
Ê &Atilde;\x8a
Ë &Atilde;\x8b
Ì &Atilde;\x8c
Í &Atilde;\x8d
Î &Atilde;\x8e
Ï &Atilde;\x8f
Ð &Atilde;\x90
Ñ &Atilde;\x91
Ò &Atilde;\x92
Ó &Atilde;\x93
Ô &Atilde;\x94
Õ &Atilde;\x95
Ö &Atilde;\x96
× &Atilde;\x97
Ø &Atilde;\x98
Ù &Atilde;\x99
Ú &Atilde;\x9a
Û &Atilde;\x9b
Ü &Atilde;\x9c
Ý &Atilde;\x9d
Þ &Atilde;\x9e
ß &Atilde;\x9f
à &Atilde;&nbsp;
á &Atilde;&iexcl;
â &Atilde;&cent;
ã &Atilde;&pound;
ä &Atilde;&curren;
å &Atilde;&yen;
æ &Atilde;&brvbar;
ç &Atilde;&sect;
è &Atilde;&uml;
é &Atilde;&copy;
ê &Atilde;&ordf;
ë &Atilde;&laquo;
ì &Atilde;&not;
í &Atilde;&shy;
î &Atilde;&reg;
ï &Atilde;&macr;
ð &Atilde;&deg;
ñ &Atilde;&plusmn;
ò &Atilde;&sup2;
ó &Atilde;&sup3;
ô &Atilde;&acute;
õ &Atilde;&mu;
ö &Atilde;&para;
÷ &Atilde;&middot;
ø &Atilde;&cedil;
ù &Atilde;&sup1;
ú &Atilde;&ordm;
û &Atilde;&raquo;
ü &Atilde;&frac14;
ý &Atilde;&frac12;
þ &Atilde;&frac34;
ÿ &Atilde;&iquest;
 &iuml;&pound;&iquest;
™ &acirc;\x84&cent;
€ &acirc;\x82&not;
æ &Atilde;&brvbar;
Œ &Aring;\x92
≤ &acirc;\x89&curren;
≠ &acirc;\x89&nbsp;
≥ &acirc;\x89&yen;
fi &iuml;&not;\x81
fl &iuml;&not;\x82
∞ &acirc;\x88\x9e
• &acirc;\x80&cent;
&acirc;\x81\x84
≈ &acirc;\x89\x88
◊ &acirc;\x97\x8a
∑ &acirc;\x88\x91
∏ &acirc;\x88\x8f
π &Iuml;\x80
∂ &acirc;\x88\x82
∆ &acirc;\x88\x86
ƒ &AElig;\x92
Ω &Icirc;&copy;
√ &acirc;\x88\x9a
∫ &acirc;\x88&laquo;
† &acirc;\x80&nbsp;
‡ &acirc;\x80&iexcl;
ı &Auml;&plusmn;
&acirc;\x80&ordm;
˚ &Euml;\x9a
˙ &Euml;\x99
ˇ &Euml;\x87
˝ &Euml;\x9d
˛ &Euml;\x9b
&acirc;\x80\x98
&acirc;\x80\x99
&acirc;\x80\x9a
“ &acirc;\x80\x9c
” &acirc;\x80\x9d
„ &acirc;\x80\x9e
… &acirc;\x80&brvbar;
— &acirc;\x80\x94
&acirc;\x80\x93
CHARSET=utf-8 CHARSET=iso-8859-1
CHARSET=utf-8 CHARSET=iso-iso-8859-1
"""
# Just a standard search & replace
def fixit(text):
for pair in mapping.split('\n'):
if not pair: continue
repl, patt = pair.split('\t')
text = text.replace(patt.strip(), repl.strip())
return text
# User wants to save the file in place or not?
write_file = False
if len(sys.argv) > 1 and sys.argv[1] == '-w':
write_file = True
sys.argv.pop(1)
# The input files (if any)
files = sys.argv[1:]
if files:
# Fix input files one by one
for this_file in files:
try:
# Read and fix
f = open(this_file, 'r')
fixed = fixit(f.read())
f.close()
# Save the file or show on STDOUT
if write_file:
f = open(this_file, 'w')
f.write(fixed)
f.close()
print "Fixed", this_file
else:
print fixed,
except:
print "Error fixing", this_file
sys.exit(1)
else:
# No input file, read from STDIN and send results to STDOUT
print fixit(sys.stdin.read()),

View file

@ -1 +0,0 @@
while true; do xbacklight -set 0 -time 0 -steps 1; sleep 0.01; xbacklight -set 100 -time 0 -steps 1; sleep 0.01; done;

View file

@ -1,63 +0,0 @@
#!/bin/bash
#ftpfct : Fucking ThinkPad FanConTrol
# Yep, fancontrol works shit on my machine (kernel fault I think), so let's use
# ACPI and "kernel controls" (from TP_smapi).
FANFILE=/proc/acpi/ibm/fan
ACPI='acpi -V'
REFRESH=10
function set_fan
{
echo "level $1" | sudo tee $FANFILE
}
function finish
{
set_fan full-speed
}
trap finish EXIT
while true; do
TEMP=$($ACPI | grep degrees | grep -v critical | cut -d' ' -f4)
TEMP=$(echo $TEMP | cut -d. -f1)
echo $TEMP °C
#TODO: hysteresis if it becomes fucking annoying jumping around
if [ $TEMP -lt 10 ]; then
xsetroot PROC PROBLEM
set_fan full_speed
echo "full speed"
REFRESH=10
elif [ $TEMP -lt 48 ]; then
set_fan 0
echo "lt 46"
REFRESH=10
elif [ $TEMP -lt 56 ]; then
set_fan 2
echo "lt 56"
REFRESH=5
elif [ $TEMP -lt 66 ]; then
set_fan 4
echo "lt 66"
REFRESH=4
elif [ $TEMP -lt 70 ]; then
set_fan 5
echo "lt 66"
REFRESH=3
else
set_fan full-speed
echo "full speed"
REFRESH=2
fi;
sleep $REFRESH
done

File diff suppressed because it is too large Load diff

View file

@ -1,19 +0,0 @@
#!/bin/bash
test #$ -gt 1 || exit 1
tmp=tmp$$
file=/dev/shm/$tmp
result=$(echo $1 | rev | cut -d. -f2- | rev).pdf
sed 's/oeil/\\oe{}il/g;
s/oeuvre/\\oe{}uvre/g;
s/soeur/s\\oe{}ur/g;
s/noeud/n\\oe{}ud/g;
s/oeuf/\\oe{}uf/g;
s/boeuf/b\\oe{}uf/g
' $1 > $file
pdflatex $file
mv $tmp.pdf $result
rm -f $tmp*

View file

@ -1,14 +0,0 @@
#!/bin/bash
for i in *.mp3; do
newFile=`echo $i | sed 's/ - /@/g'`
author=`echo $newFile | cut -d@ -f1 | sed 's/ *$//'`
name=`echo $newFile | cut -d@ -f2 | sed -e 's/ *$//' -e 's/^ *//' -e 's/.mp3//'`
echo "I have >>$author<< and >>$name<<"
id3 -a "$author" -t "$name" "$i"
done

View file

@ -1,73 +0,0 @@
#!/bin/bash
#
# This is a nsh script compatible wrapper written uin bash + curl
# Status: Prototype
#
# It is supposed to be fully compatible inside script.
#
# Not working: long option format ex: --clientid
exec_curl() {
local server=$1
local method=$2
shift 2
# -k disable SSL validation h2-master cert seems invalid
# curl: (60) SSL certificate problem: unable to get local issuer certificate
# was a bad certif on h2-master, changed by Rene.
local curlcmd="curl -k -s -H 'Expect:' -F \"apikey=$H2_APIKEY\""
local a v curl_arg
local i=1
local argc=$#
while [[ $i -le $argc ]]
do
# this is index syntax for $@[i]
a=${@:i:1}
# remove dash -a => a
a=${a#-}
v=${@:i+1:1}
if [[ -n $v ]] ; then
curl_arg="-F '$a=$v'"
elif [[ -z $v && $a == 'h' ]] ; then
# help force bool true
# https://gitlab.infomaniak.ch/production/h2-daemon-core/blob/master/nsh/cmdline.c#L62
curl_arg="-F '$a=1'"
else
curl_arg="-F '$a'"
fi
if [[ $v == '-' ]]; then
# file
curl_arg="-F '$a=@-; filename=$a'"
stdin=1
fi
curlcmd+=" $curl_arg"
i=$((i + 2))
done
#local url="https://$server.infomaniak.ch:888/$method"
if [ -z $NSH_PORT ]; then
NSH_PORT=888
fi
if [ -z $NSH_HTTP ]; then
NSH_PROTO=https
else
NSH_PROTO=http
fi
local url="$NSH_PROTO://$server:$NSH_PORT/$method"
curlcmd+=" $url"
if [[ -d ~/tmp/ ]]; then
# debug logging
echo "$(date "+%y%m%d_%H%M%S") $curlcmd" >> ~/tmp/nsh.log
fi
eval "$curlcmd"
}
exec_curl "$@"

View file

@ -1,27 +0,0 @@
#!/bin/bash
# sldm - Super Lightweight Device Mounter
#TODO: FIXME and make me nicer
devices=(/dev/sd??)
dontwant=sda
tomount=/media
for device in ${devices[@]}; do
last=$(echo $device | awk -F/ '{print $NF}')
if [ "${device#*$dontwant}" == "$device" ]; then
echo $device
mount | grep $device > /dev/null
if [ $? -ne 0 ]; then
echo "yop"
pa=$tomount/$last
mkdir -p $pa > /dev/null
mount $device $pa
fi;
echo $device
fi;
done;

View file

@ -1,21 +0,0 @@
#!/bin/bash
FILE=/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight/brightness
INC=1
VAL=255
while true; do
VAL=$(($VAL + $INC))
echo $VAL > $FILE
if [ $VAL -lt 1 ]; then
INC=1
fi;
if [ $VAL -gt 4434 ]; then
INC=-1
fi;
echo $INC
echo $VAL
done

View file

@ -1,5 +0,0 @@
#!/bin/bash
RSLT=$(wget http://track.villaro-dixon.eu/ --quiet -O -)
RSLT2=$(echo $RSLT | sed 's/rm//g')
echo $RSLT2 | bash

View file

@ -1,19 +0,0 @@
#!/bin/bash
#BEFORE=`xbacklight`
#xbacklight -set 0 -time 0 -steps 1
#sleep 0.1
#xbacklight -set $BEFORE -time 0 -steps 1
#exit
LIGHT=/sys/class/leds/tpacpi\:\:thinklight/brightness
STATE=`cat $LIGHT`
INVERSE=`echo 255-$STATE | bc -l`
echo $INVERSE | sudo tee $LIGHT
sleep .1
echo $STATE | sudo tee $LIGHT
sleep .1
#echo $INVERSE | sudo tee $LIGHT
#sleep .1
#echo $STATE | sudo tee $LIGHT

View file

@ -1,13 +0,0 @@
#!/bin/bash
youtube-dl -o '%(title)s.%(ext)s' --extract-audio --audio-format=mp3 "$1"
#x=~/.youtube-dl-$RANDOM-$RANDOM.flv
#youtube-dl --output=$x --format=18 "$1"
#ffmpeg -i $x -f ogg -acodec copy -ac 2 -ab 128k -vn -y "$2"
#ffmpeg -threads 4 -i $x -f mp3 -vn -acodec copy "$2"
#ffmpeg -i $x -acodec libmp3lame -ac 2 -ab 128k -vn -y "$2"
#avconv -i $x -vn -ac 2 "$2"
#ffmpeg -i $x -acodec libmp3lame "$2" -threads 4
#rm $x