Skip to content

Instantly share code, notes, and snippets.

View XayOn's full-sized avatar
🐍

David Francos XayOn

🐍
View GitHub Profile
@XayOn
XayOn / conf-enabled_per_user.pl
Created July 24, 2012 01:01
Degeneratedlabs per-user confis for lighttpd
#!/usr/bin/perl -wl
use strict;
use File::Glob ':glob';
my $confdir = shift || "/etc/lighttpd/conf-enabled/";
my $enabled = "users/*.conf";
chdir($confdir);
my @files = bsd_glob($enabled);
@XayOn
XayOn / dlive.list.chroot
Created July 30, 2012 04:46
Dlive packagelist
#include <standard-x11>
# Wireless firmware
firmware-linux
firmware-linux-nonfree
firmware-ralink
firmware-realtek
zd1211-firmware
firmware-atheros
firmware-intelwimax
@XayOn
XayOn / gist:3911423
Created October 18, 2012 12:14
Irssi remote notifications with irssi-dbus
# Call me with your ssh options (and probably DISPLAY=YOUR_REMOTE_DISPLAY)
# This is actually NOT the way, but the dbus-monitor approach + ssh might come handy.
ssh $@ dbus-monitor --session|while read line; do echo $line | command grep ": " &>/dev/null && notify-send "Irssi" "$(echo $line|sed s/\"//g|sed s/string//g)"; done
@XayOn
XayOn / .bashrc
Created October 18, 2012 12:53
Export dbus_session_bus_address on bashrc
# This checks if we're connecting via ssh, gets dbus-daemon --session address and exports it.
[[ -n $SSH_CLIENT ]] && export $(cat /proc/$(command pgrep -u "$USER" -f -- "dbus-daemon --session" )/environ| tr '\0' '\n' | command grep "DBUS_SESSION_BUS_ADDRESS=")
@XayOn
XayOn / gist:3934819
Created October 22, 2012 21:59
Record a specific window with recordmydesktop
# Recommended by recordmydesktop manpage
recordmydesktop --windowid $(xwininfo | awk '/Window id:/ {print $4}')
@XayOn
XayOn / gist:3935320
Created October 22, 2012 23:05
Make a screencast and upload it to youtube
read -p "Press enter to select window"
tmp=$(mktemp);
recordmydesktop --windowid $(xwininfo | awk '/Window id:/ {print $4}') -o $tmp && {
read -p "Enter video category: " category
read -p "Enter video title: " title
read -p "Enter video summary" summary
google youtube post --title "$title" --summary "$summary" --category "Tech" $tmp
}
@XayOn
XayOn / gist:3970424
Created October 28, 2012 23:26
Play the lastest file in a serie
# My dir structure is like this:
# Series name/
# Season X/
# Chapter
# So, this script get a random series and plays the lastest chapter
# This way, flexget gets all the tv series from me, and this command plays randomly the lastest chapter.
# Soon I'll add something like a read flag, or I'll check out the last file access, if last file access < 7 days, a new chapter is probably there!
a=(*); mplayer "$(find ${a[ $[ ( $RANDOM % ${#a[@]} ) + 1 ] - 1 ]}/*|tail -n1)"
@XayOn
XayOn / gist:3979955
Created October 30, 2012 12:40
shell-fm configuration file
# This makes shell-fm download everything in ~/Music/<artist>-<title>.mp3
# Then plays it with mplayer and software volume mixer, thus making volumne 10 times louder than usual max.
extern=tee ~/Music/%a-%t.mp3 | mplayer -really-quiet -softvol -softvol-max 1000 -volume 1000 -noconsolecontrols -demuxer lavf -lavfdopts format=mp3 -
np-cmd = lyricsdownloader --artist "%a" --songname "%t" 2> /dev/null > /tmp/lyrics.txt
# Then I execute a tail -f /tmp/lyrics.txt on another tmux split
@XayOn
XayOn / gist:3983568
Created October 30, 2012 22:38
Automagically scroll down an image when you scroll to its half.
($ document).ready ->
(($ document) .find '.showoff') .live 'mouseover', () ->
h = (($ this).css 'height').replace 'px', ''
($ document) .data 'next_position', ($ this).position().top + h + 20
($ document) .data 'launch_position', ($ this).position().top + (h / 2)
($ document).live 'scroll', (event) ->
if ((Number) ($ document).scrollTop() > ((Number) (($ document) .data 'launch_position'))
window.scrollTo(0, ($ document).data 'next_position')
@XayOn
XayOn / gist:4020993
Created November 5, 2012 23:03
Launch deluged, then launch flexget and get the subtitles
deluged & { flexget && sleep 1m && subdownloader -cli -l en; } &