less {filename}
| Navigation | |
|---|---|
SPACE |
forward one window |
b |
backward one window |
d |
forward half window |
| def application(environ, start_response): | |
| import sys | |
| path = 'YOUR_WWW_ROOT_DIRECTORY' | |
| if path not in sys.path: | |
| sys.path.append(path) | |
| from pyinfo import pyinfo | |
| output = pyinfo() | |
| start_response('200 OK', [('Content-type', 'text/html')]) | |
| return [output] |
| urlencode() { | |
| # urlencode <string> | |
| old_lc_collate=$LC_COLLATE | |
| LC_COLLATE=C | |
| local length="${#1}" | |
| for (( i = 0; i < length; i++ )); do | |
| local c="${1:$i:1}" | |
| case $c in |
| # Replace REMOTE_NAME with your remote name (e.g. origin) | |
| git branch -r | grep REMOTE_NAME/ | grep -v 'master$' | grep -v HEAD| cut -d/ -f2 | while read line; do git push REMOTE_NAME :$line; done; |
| # delete local tag '12345' | |
| git tag -d 12345 | |
| # delete remote tag '12345' (eg, GitHub version too) | |
| git push origin :refs/tags/12345 | |
| # alternative approach | |
| git push --delete origin tagName | |
| git tag -d tagName |
| #!/bin/bash | |
| . build/envsetup.sh | |
| mmm frameworks/base/packages/SystemUI/ | |
| adb start-server | |
| adb shell pkill -TERM -f com.android.systemui | |
| adb remount | |
| adb push $OUT/system/priv-app/SystemUI.apk /system/priv-app/SystemUI.apk | |
| adb shell pkill -TERM -f com.android.systemui | |
| adb shell chmod 0644 /system/app-priv/SystemUI.apk | |
| sleep 2 |
| # | |
| # Naive multilingual static file serving with nginx | |
| # | |
| # Requests to root (/) will be redirected to language-prefixed sub location | |
| # according to Accept-Language header. Supports only the first language in the | |
| # Accept-Language header field. | |
| # | |
| # At any other location than /: Tries requested resource at given location and | |
| # falls back to root directory (will function as default language). | |
| # |
| # Backup your packages list | |
| # Get a packages list | |
| dpkg --get-selections > ~/Package.list | |
| # Copy list of repositories | |
| sudo cp /etc/apt/sources.list ~/sources.list | |
| # Export repo keys | |
| sudo apt-key exportall > ~/Repo.keys |
| #!/usr/bin/env ruby | |
| # | |
| # Hack to use Android phone as barcode scanner for pc. | |
| # | |
| # Installation and setup: | |
| # * Enable usb debugging on your Android phone | |
| # * Make sure you have an Android SDK installed | |
| # * Make sure xdotool is installed (apt-get has it) http://www.semicomplete.com/projects/xdotool/ | |
| # * Build and install https://github.com/majido/clipper | |
| # * Start service: `adb shell su -c \'am startservice ca.zgrs.clipper/.ClipboardService\'` |