2014年8月18日星期一

openSUSE 13.1 上普通用户无法正常运行 tmux 和 mosh-server 的解决方法

(Solution to normal user can't use tmux & mosh-server)
在 /etc/fstab 中去除这行 (Remove this line from /etc/fstab):

none  /dev/pts    devpts  rw          0       0

2013年10月10日星期四

Switch between Single Display and Dual Display using xrandr in Command Line

setdual.sh:

#!/bin/bash

export DISPLAY=:0

xrandr --output HDMI-1 --rotate right --mode 1920x1080
xrandr --output LVDS-1 --pos 1080x1000


setsing.sh:

#!/bin/bash

export DISPLAY=:0

xrandr --output HDMI-1 --off

2013年5月22日星期三

Disable bitmap font on openSUSE, improving Firefox's font rendering

put http://www.publicsource.apple.com/source/X11proto/X11proto-40.4/fontconfig/fontconfig-2.7.3/conf.d/70-no-bitmaps.conf?txt under /etc/fonts/conf.d

2013年4月1日星期一

Set Direct Route to Specific Hosts, Dispite VPN Connections

#!/bin/bash

cut -d ' ' -f 1 <<EOF |
IPAddress Write comments after a space

EOF
cat > directip

for i in 3 4 5; do
dig +short mr${i}.douban.com | grep -v 'com' | grep -v 'net' >> directip
done


dig +short stream12.qqmusic.qq.com | grep -v 'com' | grep -v 'net' >> directip

sort directip | uniq > /tmp/directip

cp /tmp/directip ~/

_routeline=$(ip route | grep -v 'tun' | grep default)
GW=$(echo $_routeline | cut -d ' ' -f 3)
IF=$(echo $_routeline | cut -d ' ' -f 5)

cat directip | while read ip; do
route add -host $ip gw $GW dev $IF;
done

2012年11月8日星期四

Translating a Socks5 Proxy into an HTTP one using delegate


$ delegated -P3000 SERVER=http SOCKS=192.168.1.1:7070

this command line translates a socks proxy on 192.168.1.1:7070 to an HTTP one http://0.0.0.0:3000/

2012年3月30日星期五

对 HTML 网页做 GPG 签名

https://github.com/multiple1902/scripts/blob/master/gpghtml.sh

#!/bin/bash
#
# Written by multiple1902 <multiple1902@gmail.com>
# Released under MIT License
#
# gpghtml.sh:
# Sign a HTML page in cleartext using gnupg
#
# Usage:
# gpghtml.sh happyhour.html
#
# Requirements:
# gnupg
#
if [ -z "$1" ]; then
echo "gpghtml: please specify input file";
    exit 126
fi
TMPFILE=$(mktemp)
DEST=$(dirname "$1")/$(basename "$1" .html).signed.html
cat > "$TMPFILE" << EOF
-->
EOF
cat "$1" >> "$TMPFILE"
cat >> "$TMPFILE" << EOF
<!--
EOF
if gpg --clearsign "$TMPFILE"; then
cat > "$DEST" << EOF
<!--
EOF
    cat >> "$DEST" < "$TMPFILE.asc"
    cat >> "$DEST" << EOF
-->
EOF
    rm "$TMPFILE" "$TMPFILE.asc"
    echo "gpghtml: succ"
else
rm "$TMPFILE"
    echo "gpghtml: gpg failed to sign the file"
    return 125
fi

2012年2月19日星期日

VirtualBox USB Issue Under openSUSE Tumbleweed

Check rules under /etc/udev/rules.d/, uncomment the last 2 lines:

[multiple1902 rules.d]$ pwd
/etc/udev/rules.d

[multiple1902 rules.d]$ cat 60-vboxdrv.rules
KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="root", MODE="0600"
#these two lines give access permission to vboxusers to properly work with usb nodes, this could be security risk (bnc#664520) !!
#
SUBSYSTEM=="usb_device",ATTR{devnum}=="?*",ATTR{busnum}=="?*",SYMLINK+="vboxusb/$attr{busnum}/$attr{devnum}",RUN+="/usr/bin/setfacl -m g:vboxusers:6 /dev/vboxusb/$attr{busnum}/$attr{devnum}"
SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",ATTR{devnum}=="?*",ATTR{busnum}=="?*",SYMLINK+="vboxusb/$attr{busnum}/$attr{devnum}",RUN+="/usr/bin/setfacl -m g:vboxusers:6 /dev/vboxusb/$attr{busnum}/$attr{devnum}"