diff options
-rwxr-xr-x | add-torrent | 2 | ||||
-rwxr-xr-x | convert2mp4 | 10 | ||||
-rwxr-xr-x | create-git-repo.sh | 26 | ||||
-rwxr-xr-x | drop.sh | 2 | ||||
-rwxr-xr-x | firefox | 2 | ||||
-rwxr-xr-x | generate_gallery | 2 | ||||
-rwxr-xr-x | getpw | 3 | ||||
l--------- | git-archprojects | 1 | ||||
-rwxr-xr-x | gvim | 2 | ||||
-rwxr-xr-x | irssi_notify.sh | 20 | ||||
-rw-r--r-- | pdftops-cairo.c | 83 | ||||
-rwxr-xr-x | perlmodver | 6 | ||||
m--------- | remotes/falconindy-bin | 0 | ||||
l--------- | revdepwalk | 1 | ||||
l--------- | sabs | 1 | ||||
-rwxr-xr-x | scan | 18 | ||||
-rwxr-xr-x | send-link-to-phone.sh | 4 | ||||
-rwxr-xr-x | thunar | 1 | ||||
-rwxr-xr-x | upshot-xbindkeys | 6 | ||||
-rwxr-xr-x | urxvt-link.sh | 9 | ||||
-rwxr-xr-x | wireshark-remote | 6 |
21 files changed, 184 insertions, 21 deletions
diff --git a/add-torrent b/add-torrent new file mode 100755 index 0000000..a0c63b0 --- /dev/null +++ b/add-torrent @@ -0,0 +1,2 @@ +#!/bin/bash +transmission-remote mistral:9091 -N -a "$1" diff --git a/convert2mp4 b/convert2mp4 index fb285c9..1e8e975 100755 --- a/convert2mp4 +++ b/convert2mp4 @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 #---------------------------------------------------- # Author: Florian "Bluewind" Pritz <flo@xssn.at> # @@ -68,18 +68,22 @@ def main(): continue p1 = subprocess.Popen(["echo", "-n", name], stdout=subprocess.PIPE) p2 = subprocess.Popen(["sed", "s/\(.*\)\..*/\\1/"], stdin=p1.stdout, stdout=subprocess.PIPE) - name_mp4 = p2.communicate()[0] + ".mp4" + name_mp4 = "tmp_" + p2.communicate()[0] + ".mp4" for encpass in ["1", "2"]: if encpass == "1": filename = "/dev/null" + ffmpeg_args.append('-vpre') + ffmpeg_args.append('medium_firstpass') else: filename = name_mp4 + ffmpeg_args.append('-vpre') + ffmpeg_args.append('medium') subprocess.Popen(merge( [["ffmpeg", "-i", name, "-vcodec", "libx264", # "-r", "25", # "-g", "250", "-keyint_min", "25", - "-vpre", "hq", +# "-vpre", "hq", # "-coder", "ac", "-me_range", "16", # "-subq", "5", "-sc_threshold", "40", "-acodec", "libfaac", diff --git a/create-git-repo.sh b/create-git-repo.sh new file mode 100755 index 0000000..b724fe9 --- /dev/null +++ b/create-git-repo.sh @@ -0,0 +1,26 @@ +#!/bin/zsh + +if [[ -z $1 ]]; then + echo "$(basename $0) <reponame>" + exit 1 +fi + +repo=$1 +server="karif" +remotename="karif" +basepath=/srv/git/users/flo + +ssh $server mkdir $basepath/$repo +ssh $server git init --bare $basepath/$repo +ssh $server touch $basepath/$repo/git-daemon-export-ok + +git remote add $remotename ssh://${server}${basepath}/$repo +echo -n "Description: " +read description +ssh $server echo $description \> $basepath/$repo/description + +echo -n "Branch to push: " +read branch +git push $remotename $branch + +echo "All done." @@ -11,7 +11,9 @@ for file; do case $(file -b --mime-type "$file") in application/x-bittorrent) + chmod 644 "$file" mv "$file" /mnt/mistral/flo/torrent/watch + transmission-remote mistral:9091 -a "/mnt/mistral/flo/torrent/watch/$(basename "$file")" ;; *) # nothing diff --git a/firefox b/firefox deleted file mode 100755 index c462dcc..0000000 --- a/firefox +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -firefox-nightly "$@" diff --git a/generate_gallery b/generate_gallery new file mode 100755 index 0000000..f9763b0 --- /dev/null +++ b/generate_gallery @@ -0,0 +1,2 @@ +#!/bin/sh +~/git/generate_gallery/generate_gallery.pl "$@" @@ -0,0 +1,3 @@ +#!/bin/bash + +gpg2 --batch --decrypt ~/passwords.gpg 2>/dev/null | mpgrep "$@" diff --git a/git-archprojects b/git-archprojects new file mode 120000 index 0000000..0acab09 --- /dev/null +++ b/git-archprojects @@ -0,0 +1 @@ +remotes/falconindy-bin/git-archprojects
\ No newline at end of file @@ -1,2 +0,0 @@ -#!/bin/sh -urxvtc -e vim "$@" diff --git a/irssi_notify.sh b/irssi_notify.sh index c7281be..de3d387 100755 --- a/irssi_notify.sh +++ b/irssi_notify.sh @@ -1,9 +1,10 @@ #!/bin/bash -#pgrep irssi_notify.sh && exit +[[ -z $DISPLAY ]] && exit 1; -#tail -f $HOME/.irssi/fnotify | -ssh mistral 'inotail -f -n 0 ~/.irssi/fnotify' | +exec 0<&- + +ssh mistral 'tail -f -n0 ~/.irssi/fnotify' | sed -ru " s/&/\&/g; s/</\</g; @@ -11,11 +12,10 @@ ssh mistral 'inotail -f -n 0 ~/.irssi/fnotify' | s%(#[a-zA-Z]+ )<([^>]{0,10})>%\1<b>\2</b> %g s%(https?://[^ ]+\.[a-zA-Z]{1,3})%<a href=\"\1\">\1</a>%g; s%([a-zA-Z0-9+_-]+@[^ ]+\.[a-zA-Z]{1,3})%<a href=\"mailto:\1\">\1</a>%g;" | - while read heading message - do - if [ "X$heading" != "X" ]; then - ssh mistral 'echo "" > ~/.irssi/fnotify'; - ossplay ~/misc/High_Bee-Public_D-135.wav - notify-send -t 5000 -- "${heading}" "${message}"; - fi + while read heading message; do + if [[ -n $heading ]]; then + ssh mistral 'echo "" > ~/.irssi/fnotify'; + ossplay ~/misc/High_Bee-Public_D-135.wav + notify-send -t 5000 -- "${heading}" "${message}"; + fi done diff --git a/pdftops-cairo.c b/pdftops-cairo.c new file mode 100644 index 0000000..4447d71 --- /dev/null +++ b/pdftops-cairo.c @@ -0,0 +1,83 @@ +/* gcc -o pdftops pdftops-cairo.c `pkg-config --cflags --libs cairo poppler-glib` */ + +#include <poppler.h> +#include <cairo.h> +#include <cairo-ps.h> + +int main(int argc, char *argv[]) +{ + PopplerDocument *document; + PopplerPage *page; + double width, height; + GError *error; + const char *filename; + gchar *absolute, *uri; + int num_pages, i; + cairo_surface_t *surface; + cairo_t *cr; + cairo_status_t status; + + if (argc != 2) { + printf ("Usage: pdftops-cairo input_file.pdf\n"); + return 0; + } + + filename = argv[1]; + g_type_init (); + error = NULL; + + if (g_path_is_absolute(filename)) { + absolute = g_strdup (filename); + } else { + gchar *dir = g_get_current_dir (); + absolute = g_build_filename (dir, filename, (gchar *) 0); + free (dir); + } + + uri = g_filename_to_uri (absolute, NULL, &error); + free (absolute); + if (uri == NULL) { + printf("poppler fail: %s\n", error->message); + return 1; + } + + document = poppler_document_new_from_file (uri, NULL, &error); + if (document == NULL) { + printf("poppler fail: %s\n", error->message); + return 1; + } + + num_pages = poppler_document_get_n_pages (document); + + /* Page size does not matter here as the size is changed before + * each page */ + surface = cairo_ps_surface_create ("/dev/stdout", 595, 842); + cr = cairo_create (surface); + for (i = 0; i < num_pages; i++) { + page = poppler_document_get_page (document, i); + if (page == NULL) { + printf("poppler fail: page not found\n"); + return 1; + } + poppler_page_get_size (page, &width, &height); + cairo_ps_surface_set_size (surface, width, height); + cairo_save (cr); + poppler_page_render_for_printing (page, cr); + cairo_restore (cr); + cairo_surface_show_page (surface); + g_object_unref (page); + } + status = cairo_status(cr); + if (status) + printf("%s\n", cairo_status_to_string (status)); + cairo_destroy (cr); + cairo_surface_finish (surface); + status = cairo_surface_status(surface); + if (status) + printf("%s\n", cairo_status_to_string (status)); + cairo_surface_destroy (surface); + + g_object_unref (document); + + return 0; +} diff --git a/perlmodver b/perlmodver new file mode 100755 index 0000000..298079f --- /dev/null +++ b/perlmodver @@ -0,0 +1,6 @@ +#!/usr/bin/perl +use strict; +foreach my $module ( @ARGV ) { + eval "require $module"; + printf( "%-20s: %s\n", $module, $module->VERSION ) unless ( $@ ); +}
\ No newline at end of file diff --git a/remotes/falconindy-bin b/remotes/falconindy-bin -Subproject 773d64bb189d3528e7a53345f95e0ddbcae929e +Subproject 009502349e458c67576701ab317bf6ea28ebbc5 diff --git a/revdepwalk b/revdepwalk new file mode 120000 index 0000000..8f724c6 --- /dev/null +++ b/revdepwalk @@ -0,0 +1 @@ +remotes/falconindy-bin/revdepwalk
\ No newline at end of file @@ -0,0 +1 @@ +remotes/falconindy-bin/sabs
\ No newline at end of file @@ -0,0 +1,18 @@ +#!/bin/bash + +if [[ $1 == -h ]]; then + echo "usage: scan [<resolution> [<format> [<extra name>]]]" + exit +fi + +resolution=${1:-200} +format=${2:-jpg} +extra=$3 + +if [[ -n $extra ]]; then + extra="_$extra" +fi + +file="scan_$(date +%Y-%m-%d_%H%M%S)${extra}.${format}" + +scanimage --resolution $resolution | convert - "$file" diff --git a/send-link-to-phone.sh b/send-link-to-phone.sh index b5e0267..d08db42 100755 --- a/send-link-to-phone.sh +++ b/send-link-to-phone.sh @@ -1,3 +1,3 @@ -#!/bin/sh +#!/bin/zsh -ssh aero dbus-send --system --type=method_call --dest=com.nokia.osso_browser /com/nokia/osso_browser/request com.nokia.osso_browser.load_url string:"$1" +ssh aero 'dbus-send --system --type=method_call --dest=com.nokia.osso_browser /com/nokia/osso_browser/request com.nokia.osso_browser.load_url string:"'$1'"' @@ -1,3 +1,4 @@ #!/bin/sh dbus-send --session --dest=org.xfce.Thunar /org/xfce/Thunar org.xfce.Thunar "string:" "string:" &>/dev/null +sleep 0.1 /usr/bin/thunar "$@" diff --git a/upshot-xbindkeys b/upshot-xbindkeys new file mode 100755 index 0000000..052a179 --- /dev/null +++ b/upshot-xbindkeys @@ -0,0 +1,6 @@ +#!/bin/sh +sleep 0.1 +file=$(scrot -s -e 'echo $f') +#gimp "$file" +urxvt -geometry 79x1 -e fb "$file" +rm "$file" diff --git a/urxvt-link.sh b/urxvt-link.sh index 9db1107..ec49820 100755 --- a/urxvt-link.sh +++ b/urxvt-link.sh @@ -1,3 +1,8 @@ -#!/bin/sh +#!/bin/bash echo -n "$1" | nohup >/dev/null 2>&1 xclip -firefox "$1" + +if [[ $1 =~ http://(www.)?youtube.com/* ]]; then + chromium "$1" +else + firefox "$1" +fi diff --git a/wireshark-remote b/wireshark-remote new file mode 100755 index 0000000..ea295f5 --- /dev/null +++ b/wireshark-remote @@ -0,0 +1,6 @@ +#!/bin/bash + +host="$1" +iface="$2" + +wireshark -k -i <(ssh "$host" tshark -i "$iface" -w - not tcp port 22) |