Skip to content

Instantly share code, notes, and snippets.

#我的 Vim 指令筆記

##vim 的三種模式 ###模式

  • 輸入模式:輸入內文。
  • 指揮模式:也叫指令模式,主要是進入到可以對文件做修改,複製,剪下貼上,游標移動等動作。
  • 執行模式:文件存檔,離開等等行為。

###常用模式的切換

  • 輸入模式 -> 指揮模式 : 鍵盤 Esc
Ptr<RateErrorModel> em = CreateObject<RateErrorModel> ();
em->SetAttribute ("ErrorUnit", EnumValue (RateErrorModel::ERROR_UNIT_PACKET));
em->SetAttribute ("ErrorRate", DoubleValue (errorRate));
NetDeviceContainer proxyRouterDevice = ...;
proxyRouterDevice.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (em));
@hungtatai
hungtatai / gist:dbfbb65b10e745e9d72e
Created February 14, 2016 08:48
Passing base64 encoded strings in URL
function base64_url_encode($input) {
//return strtr(base64_encode($input), '+/=', '-_,');
return strtr(base64_encode($input), '+/=', '-_~');
}
function base64_url_decode($input) {
//return base64_decode(strtr($input, '-_,', '+/='));
return base64_decode(strtr($input, '-_~', '+/='));
}
from urllib.request import urlopen
import bs4
while True:
word = input("Please type your word here: ")
html = urlopen("https://tw.dictionary.search.yahoo.com/search?p=%s" % word).read().decode("utf-8")
bs = bs4.BeautifulSoup(html, "html.parser")
explainArea = bs.select(".explain.DictionaryResults")[0]
wordClassList = explainArea.select(".compTitle")
from urllib.request import urlopen
import bs4
import os.path
import openpyxl
# openpyxl: http://liyangliang.me/posts/2013/02/using-openpyxl-to-read-and-write-xlsx-files/
def yahoo_dict(word):
html = urlopen("https://tw.dictionary.search.yahoo.com/search?p=%s" % word).read().decode("utf-8")
bs = bs4.BeautifulSoup(html, "html.parser")
from urllib.request import urlopen
import bs4
def dreye_dict(word):
html = urlopen("http://yun.dreye.com/dict_new/dict.php?w=%s" % word).read().decode("utf-8")
bs = bs4.BeautifulSoup(html, "html.parser")
usualExps = bs.select(".sg.block")[0]
mv /etc/localtime /etc/localtime-old
ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime
/sbin/hwclock --systohc
date
@hungtatai
hungtatai / listening.sh
Created October 10, 2016 13:14 — forked from mtarbit/listening.sh
A bash function wrapper for lsof to find any listening processes.
listening() {
if [ -z "$1" ]; then
lines=$(lsof -P -s TCP:LISTEN -i TCP | tail -n +2)
pairs=$(echo -n "$lines" | awk '{split($9,a,":"); print $2":"a[2]}' | uniq)
format_string="%5s %5s %s\n"
if [ -n "$pairs" ]; then
printf "$format_string" "PORT" "PID" "COMMAND"
for pair in $pairs; do
String.prototype.copyToClipboard = function() {
/* https://gist.github.com/joeperrin-gists/8814825#gistcomment-1581738 */
var text = this;
const input = document.createElement('input');
input.style.position = 'fixed';
input.style.opacity = 0;
input.value = text;
document.body.appendChild(input);
input.select();
document.execCommand('Copy');
# http://stackoverflow.com/questions/19275856/auto-yes-to-the-license-agreement-on-sudo-apt-get-y-install-oracle-java7-instal
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
sudo apt-get -y install oracle-java8-installer
# sudo apt-get -y install oracle-java7-installer