2014-06-19 聚會手記

上一週 || 下一週

viller

tig - ncurses-based Git repository browser
在專案資料夾執行 tig (此畫面爲 main view)
用 j/k 上下移動
按 Enter 查看檔案 diff
按 t 進入此 commit 的 tree view
再按 Enter 可檢視此次修改後檔案的完整程式碼 (省去 checkout 的麻煩)
按 q 回上一層或按 m 回到 main view

Carl

查看某次 commit 的檔案的完整程式嗎內容
$ git show <rev>:<file>

warren

各國國旗
http://www.virgintaipei.com/
基本 長:寬 = 3:5

philipz

mqttwarn
How do your servers talk to you?
http://jpmens.net/2014/04/03/how-do-your-servers-talk-to-you/

Pushover: Simple Notifications for Android, iOS, and Desktop
https://pushover.net/

GameThrive - Free Mobile Push Notifications for Game Developers
https://gamethrive.com/

Mobile Push Messaging
http://leanstack.io/mobile-push-messaging

Automate the Web - Zapier
https://zapier.com/

RJ

Sigram is a native, open source Telegram client for Linux desktops, written in C++, C, Qt, QML.
http://labs.sialan.org/projects/sigram

yan

suspend to ram

# echo mem > /sys/power/state

Controlling wakeup

# cat /proc/acpi/wakeup
# echo " LID" > /proc/acpi/wakeup

test acpi event

# apt-get install acpid
$ acpi_listen

# evtest
3 -> LCD open/close
4 -> power button

熒幕開合事件

# vi /etc/acpi/events/lid
event=button[ /]lid                                                                                              
action=/etc/acpi/actions/lid_handler.sh %e

# chmod u+x /etc/acpi/events/lid

熒幕開合事件處理指令

# vi /etc/acpi/actions/lid_handler.sh

#!/bin/sh                                                                                                        
# check if the lid is open or closed, using the /proc file
if grep closed /proc/acpi/button/lid/LID/state >/dev/null ; then
    # if the lid is now closed, save the network state and suspend to RAM
    /usr/share/wicd/daemon/suspend.py
    pm-suspend
else
    # if the lid is now open, restore the network state.
    # (if we are running, a wakeup has already occured!)
    /usr/share/wicd/daemon/autoconnect.py
fi

# chmod u+x /etc/acpi/actions/lid_handler.sh

低電量事件

# vi /etc/acpi/events/battery

event=battery.*                                                                                              
action=/etc/acpi/actions/low_battery_warning.sh %e

# chmod u+x /etc/acpi/events/battery

低電量事件處理指令

# vi /etc/acpi/actions/low_battery_warning.sh

#!/bin/sh
# Location of acpi files.
path="/sys/class/power_supply/BAT1"

# full=`cat $path/info|grep 'last full capacity'|awk -F: '{print $2}'|awk -Fm '{print $1}'`
# current=`cat $path/state|grep 'remaining capacity'|awk -F: '{print $2}'|awk -Fm '{print $1}'`
# state=$(( current * 100 / $full))
capacity=`cat $path/capacity`

# export XAUTHORITY=/home/yan/.Xauthority
export DISPLAY=:0 # This is needed so that the script can post to the display (using the zenity command, running through su as steph).

if [[ $capacity -lt 21 ]]
then
    # zenity --warning --title "Battery" --text "Low battery. (state = $state)"
    su yan -c "notify-send -u critical 'Low battery.'"
fi

# chmod u+x /etc/acpi/actions/low_battery_warning.sh

acpid (简体中文) - ArchWiki
https://wiki.archlinux.org/index.php/Acpid_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)

Suspending to RAM with hibernate-script - ArchWiki
https://wiki.archlinux.org/index.php/Suspending_to_RAM_with_hibernate-script

Doro One Two Three: Debug ACPI in Ubuntu
http://rickey-nctu.blogspot.tw/2013/05/debug-acpi-in-ubuntu.html

Laptop Mode Tools (many device tweak setting + acpid + CPU frequency scaling + pm-utils)
https://wiki.archlinux.org/index.php/Laptop_Mode_Tools

Mat

如何正確的取得使用者 IP?
http://devco.re/blog/2014/06/19/client-ip-detection/

除非特別註明,本頁內容採用以下授權方式: Creative Commons Attribution-ShareAlike 3.0 License