From a74b3c31f95f72cf2aac7e74b77d319eb6bf34c6 Mon Sep 17 00:00:00 2001 From: Horus3 Date: Thu, 11 Sep 2014 14:36:57 +0200 Subject: wp: read more button for custom excerpts --- wordpress/functions.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wordpress/functions.php b/wordpress/functions.php index 464d9a3..ff849a2 100644 --- a/wordpress/functions.php +++ b/wordpress/functions.php @@ -9,6 +9,7 @@ function movejquerytofooter(){ wp_enqueue_script('jquery'); } } +add_action( 'init', 'movejquerytofooter'); // Disable W3TC footer comment for everyone but Admins (single site & network mode) if ( !current_user_can( 'activate_plugins' ) ) { @@ -22,3 +23,12 @@ function var_piwik() { wp_enqueue_script('piwik'); } } +add_action( 'init', 'var_piwik'); + +// Add "Read more" button to custom excerpts +function custom_excerpt($text) { + $text = preg_replace('/<\/p>$/', '', $text ); + $excerpt = $text . '
' . __( 'Read more', 'papercuts' ) . '

'; + return $excerpt; +} +add_filter('the_excerpt', 'custom_excerpt'); -- cgit v1.2.3 From 23ef2763f0b0645871d8294a1e2aa9fe5660b66b Mon Sep 17 00:00:00 2001 From: Horus3 Date: Wed, 8 Oct 2014 02:16:43 +0200 Subject: added autoshut.sh --- bin/autoshut.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 bin/autoshut.sh diff --git a/bin/autoshut.sh b/bin/autoshut.sh new file mode 100755 index 0000000..8c677ee --- /dev/null +++ b/bin/autoshut.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +function idle { + prog="$1" + while pgrep "$prog" >/dev/null; do + sleep 3 + done + shutdown -hP now +} + +prog="irssi" +daemon=false + +if [ $UID != 0 ]; then + read -p "We aren't root! Are you sure you have the proper permissions? If yes, press any key to continue or CTRL+C to abort. " null +fi + +while [ $# -gt 0 ]; do + if [ "$1" == "-p" ]; then + shift + prog="$1" + shift + elif [ "$1" == "-d" ]; then + daemon=true + shift + else + echo "Unsupported argument '$1'" 1>&2 + exit 1 + fi +done + +if [ -z "$prog" ] || [ "$prog" == "" ]; then + echo "I'm confused. Which programm shall I monitor? Tell me, master!" 1>&2 + exit 1 +fi + +if [ $daemon == true ]; then + idle "$prog" >/dev/null 2>&1 & + disown +else + idle "$prog" >/dev/null 2>&1 +fi -- cgit v1.2.3 From 13357bb5830ab40164bd2b4b1efcde431a68e5fd Mon Sep 17 00:00:00 2001 From: Horus3 Date: Fri, 10 Oct 2014 12:48:18 +0200 Subject: autoshut.sh printhelp() --- bin/autoshut.sh | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/bin/autoshut.sh b/bin/autoshut.sh index 8c677ee..8be2e56 100755 --- a/bin/autoshut.sh +++ b/bin/autoshut.sh @@ -2,18 +2,23 @@ function idle { prog="$1" - while pgrep "$prog" >/dev/null; do + while pgrep "$prog" >/dev/null 2>&1; do sleep 3 done shutdown -hP now } -prog="irssi" -daemon=false +usage="Usage: $0 [-d] [-p PROCESS]" +function printhelp { + echo "A small shellscript which shutdowns your computer when a specific process ends" + echo $usage + echo "-d daemonize into the background" + echo "-p PROCESS commit the process name for which we are waiting to finish" + exit +} -if [ $UID != 0 ]; then - read -p "We aren't root! Are you sure you have the proper permissions? If yes, press any key to continue or CTRL+C to abort. " null -fi +prog="" +daemon=false while [ $# -gt 0 ]; do if [ "$1" == "-p" ]; then @@ -23,18 +28,26 @@ while [ $# -gt 0 ]; do elif [ "$1" == "-d" ]; then daemon=true shift + elif [ "$1" == "-h" ] || [ "$1" == "--help" ]; then + printhelp else - echo "Unsupported argument '$1'" 1>&2 + echo "Unsupported argument '$1'. Try '-h' for more help." 1>&2 exit 1 fi done if [ -z "$prog" ] || [ "$prog" == "" ]; then echo "I'm confused. Which programm shall I monitor? Tell me, master!" 1>&2 + echo $usage exit 1 fi +if [ $UID != 0 ]; then + read -p "We aren't root! Are you sure you have the proper permissions? If yes, press any key to continue or CTRL+C to abort. " null +fi + if [ $daemon == true ]; then + echo "Daemonizing..." idle "$prog" >/dev/null 2>&1 & disown else -- cgit v1.2.3 From e7936e6381ae55a13a32087e4a66dab2088913a3 Mon Sep 17 00:00:00 2001 From: Horus3 Date: Wed, 22 Oct 2014 20:02:18 +0200 Subject: Quersumme von Sätzen basierend auf ASCII Wert --- bin/quer.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 bin/quer.py diff --git a/bin/quer.py b/bin/quer.py new file mode 100755 index 0000000..3e37276 --- /dev/null +++ b/bin/quer.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python +# Berechnet die Quersummer eines Strings, der per STDIN gelesen wird. +# echo "Das ist ein String" | ./query.py + +import fileinput + +quer = 0 + +for line in fileinput.input(): + l = list(line) + for char in l: + quer = quer+ord(char) +print quer -- cgit v1.2.3