From 6605810da359b36f22ae3ee3f0a4ffa9eb1aa33d Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Tue, 21 Dec 2010 20:57:09 +0100 Subject: misc changes Signed-off-by: Florian Pritz --- openbox-shutdown.py | 2 +- ossmixer.py | 2 +- phpa.php | 152 ---------------------------------------------------- screen-locker.sh | 7 +-- upgpkg | 2 +- woof | 2 +- 6 files changed, 8 insertions(+), 159 deletions(-) delete mode 100755 phpa.php diff --git a/openbox-shutdown.py b/openbox-shutdown.py index 2f007a8..356c1b4 100755 --- a/openbox-shutdown.py +++ b/openbox-shutdown.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 #---------------------------------------------------- # Author: ZaB|SHC|@irc.freenode.net # diff --git a/ossmixer.py b/ossmixer.py index 9eb7fba..082fb98 100755 --- a/ossmixer.py +++ b/ossmixer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 "A simple volume control applet." import gtk diff --git a/phpa.php b/phpa.php deleted file mode 100755 index 48a1df9..0000000 --- a/phpa.php +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/php -qCn - -*/ - - __phpa__setup(); - __phpa__print_info(); - - for (;;) - { - readline_completion_function("__phpa__rl_complete"); - $__phpa__line = readline(">>> "); - if ($__phpa__line === false) - { - echo "\n"; - break; - } - if (strlen($__phpa__line) == 0) - continue; - if ((!isset($__phpa__hist)) || (($__phpa__line != $__phpa__hist))) - { - readline_add_history($__phpa__line); - $__phpa__hist = $__phpa__line; - } - - if (__phpa__is_immediate($__phpa__line)) - $__phpa__line = "return ($__phpa__line)"; - - ob_start(); - $ret = eval("unset(\$__phpa__line); $__phpa__line;"); - if (ob_get_length() == 0) - { - if (is_bool($ret)) - echo ($ret ? "true" : "false"); - else if (is_string($ret)) - echo "'" . addcslashes($ret, "\0..\37\177..\377") . "'"; - else if (!is_null($ret)) - print_r($ret); - } - unset($ret); - $out = ob_get_contents(); - ob_end_clean(); - if ((strlen($out) > 0) && (substr($out, -1) != "\n")) - $out .= "\n"; - echo $out; - unset($out); - } - - function __phpa__rl_complete($line, $pos, $cursor) - { - $const = array_keys(get_defined_constants()); - $var = array_keys($GLOBALS); - - $func = get_defined_functions(); - $s = "__phpa__"; - foreach ($func["user"] as $i) - if (substr($i, 0, strlen($s)) != $s) - $func["internal"][] = $i; - $func = $func["internal"]; - - return array_merge($const, $var, $func); - } - - function __phpa__is_immediate($line) - { - $skip = array("class", "declare", "die", "echo", "exit", "for", - "foreach", "function", "global", "if", "include", - "include_once", "print", "require", "require_once", - "return", "static", "switch", "unset", "while"); - $okeq = array("===", "!==", "==", "!=", "<=", ">="); - $code = ""; - $sq = false; - $dq = false; - for ($i = 0; $i < strlen($line); $i++) - { - $c = $line{$i}; - if ($c == "'") - $sq = !$sq; - else if ($c == '"') - $dq = !$dq; - else if (($sq) || ($dq)) - { - if ($c == "\\") - $i++; - } - else - $code .= $c; - } - $code = str_replace($okeq, "", $code); - if (strcspn($code, ";{=") != strlen($code)) - return false; - $kw = split("[^A-Za-z0-9_]", $code); - foreach ($kw as $i) - if (in_array($i, $skip)) - return false; - return true; - } - - function __phpa__print_info() - { - $ver = phpversion(); - $sapi = php_sapi_name(); - $date = __phpa__build_date(); - $os = PHP_OS; - echo "PHP $ver ($sapi) ($date) [$os]\n"; - } - - function __phpa__build_date() - { - ob_start(); - phpinfo(INFO_GENERAL); - $x = ob_get_contents(); - ob_end_clean(); - $x = strip_tags($x); - $x = explode("\n", $x); - $s = array("Build Date => ", "Build Date "); - foreach ($x as $i) - foreach ($s as $j) - if (substr($i, 0, strlen($j)) == $j) - return trim(substr($i, strlen($j))); - return "???"; - } - - function __phpa__setup() - { - if (version_compare(phpversion(), "4.3.0", "<")) - { - echo "PHP 4.3.0 or above is required.\n"; - exit(111); - } - if (!extension_loaded("readline")) - { - $prefix = (PHP_SHLIB_SUFFIX == "dll") ? "php_" : ""; - if (!@dl($prefix . "readline." . PHP_SHLIB_SUFFIX)) - { - echo "The 'readline' module is required.\n"; - exit(111); - } - } - error_reporting(E_ALL | E_STRICT); - ini_set("error_log", NULL); - ini_set("log_errors", 1); - ini_set("html_errors", 0); - ini_set("display_errors", 0); - while (ob_get_level()) - ob_end_clean(); - ob_implicit_flush(true); - } -?> diff --git a/screen-locker.sh b/screen-locker.sh index 96c0965..b5ec254 100755 --- a/screen-locker.sh +++ b/screen-locker.sh @@ -12,15 +12,16 @@ lock () { gajim-remote change_status away & - ssh mistral 'python ~/bin/irssi_socket_control.py 1' + ssh mistral 'python2 ~/bin/irssi_socket_control.py 1' # (sleep 0.5 && swarp 0 0) & - xset dpms force off + xset dpms 5 5 5 slock } unlock () { + xset dpms 0 0 0 gajim-remote change_status online & - ssh mistral 'python ~/bin/irssi_socket_control.py 0' + ssh mistral 'python2 ~/bin/irssi_socket_control.py 0' } if pidof slock &> /dev/null; then exit 1; fi diff --git a/upgpkg b/upgpkg index 5a35057..357140d 100755 --- a/upgpkg +++ b/upgpkg @@ -107,7 +107,7 @@ if [ -f "upgpkg" ]; then fi for i in $gpgsource; do - sigfile="$(basename "$i")" + sigfile="${i##*/}" if [[ $sigfile != $i ]]; then wget -nv -O "$sigfile" "$i" fi diff --git a/woof b/woof index b1f509b..03de063 100755 --- a/woof +++ b/woof @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # -*- encoding: utf-8 -*- # # woof -- an ad-hoc single file webserver -- cgit v1.2.3-24-g4f1b