Skip to content

Instantly share code, notes, and snippets.

@floreo
floreo / GP5.sh
Created January 14, 2017 14:58
Shell script wrapper for Guitar Pro 5 with timidity
#!/usr/bin/env bash
# starting timdity
timidity -iA -B2,8 -Os -EFreverb=0 &
# get timidity's PID
_PID="$!"
# start GP5
/usr/share/playonlinux/playonlinux --run "GP5"
@floreo
floreo / xbox360.sh
Last active April 12, 2018 15:31
xbox360 controllers with xboxdrv
#!/usr/bin/env bash
# apt install xboxdrv
# added at session opening
# visudo -f /etc/sudoers.d/xbox360
# floreo ALL = (root) NOPASSWD: /usr/bin/xboxdrv
sudo xboxdrv --daemon --dbus session \
-i 0 --wid 0 --detach-kernel-driver --mimic-xpad \
--next-controller -i 0 --wid 1 --detach-kernel-driver --mimic-xpad \
@floreo
floreo / .conkyrc
Created September 28, 2016 16:57
Simple .conkyrc
own_window yes
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_argb_visual yes
own_window_argb_value 100
out_to_console no
use_xft yes
xftfont cure:size=10
update_interval 1
@floreo
floreo / screen.sh
Last active September 21, 2016 17:46
Switch screen && sound && color temperature using xrandr/pactl/redshift
#!/bin/bash
# Switch screen && sound && color temperature using xrandr/pactl/redshift
## CONFIGURATION
_USB_SINK="$( pactl list short sinks | grep 'usb' | awk '{ print $1 }' )"
_HDMI_SINK="$( pactl list short sinks | grep 'hdmi' | awk '{ print $1 }' )"
@floreo
floreo / gist:1f389c1850ca5ee5cdf9
Created September 13, 2014 15:06
[vi] Change end of line of a file to unix one
Start vi, and type
:set fileformat=unix
Save it, done
@floreo
floreo / jail.local
Last active November 12, 2015 10:14
[teeworlds][fail2ban] use fail2ban to protect your teeworlds servers
[teeworlds-overflows]
enabled = true
port = 8300:8310
protocol = udp
filter = teeworlds-overflows
logpath = /var/log/teeworlds/*.log
maxretry = 2
findtime = 2
bantime = 60
@floreo
floreo / convert hex timestamp to datetime
Last active August 29, 2015 14:06
[teeworlds] convert hexa timestamp into datetime realtime log
#!/bin/bash
# may require gawk if you get the following error: function strftime never defined
# thanks to minus and guest__ for help on teeworlds IRC chan
teeworlds-server -f test.conf | gawk '{match($0, /\[([0-9a-f]+)\](.*)/, a); if(a[1]!="")$1="[" strftime("%F %T", strtonum("0x" a[1])) "]"; $1=$1a[2]; print }'
# simpler way (doesn't convert, simply dump the system's time, fflush is required to not have buffering issues)
teeworlds-server -f test.conf | gawk 'BEGIN { FS="]"; OFS=FS } /^\[.+\]/ { $1="["strftime("%F %T", systime()); print; fflush() }' &>>/var/log/teeworlds/test.log &
@floreo
floreo / generate_add_vote.sh
Last active September 14, 2016 17:29
[teeworlds] Generate an add_vote for sv_map out of your maps folder (quick and dirty)
#!/bin/bash
# first, cd to your maps folder then execute this one liner
ls *.map | while read _map; do _m="$(echo $_map | awk -F '.' '{print $1}')"; echo "add_vote \"change map to $_m\" sv_map $_m"; done >> add_vote