This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Open the default file if it is present. | |
(if (file-exists-p "~/org/TODO.org") | |
(setq initial-buffer-choice "~/org/TODO.org")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sleep 15; import xxx.jpg; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; This is a function copied from stackoverflow to facify #if 0/#else/#endif keywords. | |
;; The comments are added by myself to make it understandable. | |
(defun my-c-mode-font-lock-if0 (limit) | |
(save-restriction | |
(widen) | |
(save-excursion | |
(goto-char (point-min)) | |
(let ((depth 0) str start start-depth) | |
;; Search #if/#else/#endif using regular expression. | |
(while (re-search-forward "^\\s-*#\\s-*\\(if\\|else\\|endif\\)" limit 'move) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ -t 0 ] | |
then | |
echo "Input is a terminal" | |
else | |
echo "Input is NOT a terminal" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Modern Unix systems use user groups to control access privileges. The wheel group is a special user group used on some Unix systems to control access to the su command, which allows a user to masquerade as another user (usually the super user). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. pacmd is a good tool to help you get current pulseaudio information. | |
list-sinks | |
list-clients |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mplayer2 -dumpstream /dev/sr0 -nocache -noidx -dumpfile record.mp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ifname=$1 | |
let bytes1=0 | |
while true; do | |
let bytes2=`ip -s link show $ifname | grep -A 1 RX | grep -v RX | awk '{print $1}'` | |
let diff=(bytes2 - bytes1) | |
let diff=(diff / 1024 / 1024) | |
echo "bandwitdth is $diff Mbps" | |
let bytes1=bytes2 | |
sleep 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ps -eo rss,pid,comm | awk '{s+=$1} END {print s}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import eventlet | |
pool = eventlet.GreenPool() | |
def bomb(): | |
a = eventlet.connect(("127.0.0.1", 9697)) | |
eventlet.sleep(10) | |
a.close() | |
i=0 | |
while i<5000: | |
pool.spawn(bomb) |
OlderNewer