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
#include <condition_variable> | |
#include <fstream> | |
#include <mutex> | |
#include <queue> | |
#include <streambuf> | |
#include <string> | |
#include <thread> | |
#include <vector> | |
struct async_buf |
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
(defun dotspacemacs/init () | |
(setq configuration-layer--elpa-archives | |
'(("gnu" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/") | |
("melpa" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/") | |
("melpa-stable" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/melpa-stable/") | |
("org" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/org/") | |
("marmalade" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/marmalade/"))) |
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
sudo apt-get install build-essential pkg-config libc6-dev libssl-dev libexpat1-dev libavcodec-dev libgl1-mesa-dev qt5-default | |
wget http://www.makemkv.com/download/makemkv-oss-1.10.2.tar.gz | |
wget http://www.makemkv.com/download/makemkv-bin-1.10.2.tar.gz | |
tar -xvf makemkv-oss-1.10.2.tar.gz | |
tar -xvf makemkv-bin-1.10.2.tar.gz | |
cd makemkv-oss-1.10.2/ | |
./configure | |
make | |
sudo make install |
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
random-string() | |
{ | |
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 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
git clone https://github.com/ym/anti-hijack-list.git | |
#replace default server address to local | |
sed -i 's/155.254.49.43/127.0.0.1/g' dnsmasq/hijack.conf | |
sudo ln -s `pwd`/dnsmasq/hijack.conf /etc/dnsmasq.d/ | |
sudo ln -s `pwd`/htdocs /var/www/anti-hijack | |
sudo apt-get install nginx | |
sudo ln -s `pwd`/nginx/hijack.conf /etc/nginx/ | |
sudo vi /etc/NetworkManager/NetworkManager.conf | |
# add dns=dnsmasq at section [main] |
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
git clone https://github.com/shadowsocks/libQtShadowsocks.git | |
sudo apt-get install qt5-qmake qtbase5-dev libqrencode-dev libappindicator-dev libzbar-dev libbotan1.10-dev build-essential autoconf libtool libssl-dev gawk debhelper dh-systemd init-system-helpers pkg-config | |
cd libQtShadowsocks | |
dpkg-buildpackage -us -uc -b | |
#install libqtshadowsocks-dev before build shadowsocks-qt5 | |
#sudo dpkg -i libqtshadowsocks-dev_1.8.4-1_amd64.deb | |
sudo dpkg -i libqtshadowsocks-dev_*.deb | |
git clone https://github.com/shadowsocks/shadowsocks-qt5.git |
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
# -*- coding: utf-8 -*- | |
from bs4 import BeautifulSoup | |
import requests | |
username = '' ###账号### | |
password = '' ###密码### | |
login_url = 'http://v2ex.com/signin' ###如V2EX设置了使用 SSL,必须改 https### | |
index_url = 'http://v2ex.com' ###同上### | |
mission_url = 'http://www.v2ex.com/mission/daily' ###同上### | |
UA = "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) \ |
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
rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress /root/bigfile.txt 198.211.117.129:/root/ |
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
QTextBlock block = document()->begin(); | |
while(block.isValid()) { | |
if(document()->blockCount() > m_maxlines) | |
{ | |
QTextCursor cursor(block); | |
block = block.next(); | |
cursor.select(QTextCursor::BlockUnderCursor); | |
//move forward one character to select the return-char, | |
//in order to avoid the empty line after the selected text is removed. | |
cursor.movePosition(QTextCursor::NextCharacter,QTextCursor::KeepAnchor); |
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
/** | |
* Returns the current resident set size (physical memory use) measured | |
* in bytes, or zero if the value cannot be determined on this OS. | |
*/ | |
size_t getCurrentRSS( ) | |
{ | |
long rss = 0L; | |
FILE* fp = NULL; | |
if ( (fp = fopen( "/proc/self/statm", "r" )) == NULL ) | |
return (size_t)0L; /* Can't open? */ |
NewerOlder