import time
from datetime import datetime
import pytz
In [14]: t = datetime.fromtimestamp(1546751128, pytz.timezone('Asia/Shanghai')).strftime('%Y-%m-%d %H:%M:%S')
In [15]: t
Out[15]: '2019-01-06 13:05:28'
This file contains hidden or 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/bash | |
setxkbmap -option caps:none | |
xmodmap -e "keycode 66 = End NoSymbol End NoSymbol End" | |
xmodmap -e "keycode 112 = BackSpace BackSpace BackSpace BackSpace" | |
This file contains hidden or 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 <iostream> | |
#include "curl/curl.h" | |
int main() { | |
curl_version_info_data* ver = curl_version_info(CURLVERSION_NOW); | |
std::cout << ver->ssl_version << std::endl; | |
return 0; | |
} |
This file contains hidden or 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
from http.server import HTTPServer, BaseHTTPRequestHandler | |
from socketserver import ThreadingMixIn | |
class Handler(BaseHTTPRequestHandler): | |
protocol_version = 'HTTP/1.1' | |
def do_GET(self): | |
rsp = b'GET' | |
self.send_response(200) | |
self.send_header('Content-Length', len(rsp)) |
find command with exclude
find -name "*.js" -not -path "./directory/*" -not -path "*thrift_gen/*"
remove duplicate column:
awk '!seen[$0]++' filename
This file contains hidden or 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
set -ex | |
prepath=`dirname $PWD` | |
# make sure both mac & devbox satisfy, $GOPATH=$HOME/go | |
myhome="${HOME}/" | |
prepath=${prepath:${#myhome}} | |
# set your own devbox username, mine is liuxiguang | |
devboxusername="liuxiguang" | |
sshpass -p ${devboxusername} rsync -avr --delete --exclude=test.go --exclude=.idea --exclude=.vscode --exclude=output ${PWD} dev:/home/${devboxusername}/$prepath | |
echo $(date -u +"%Y-%m-%d %H:%M:%S%Z") |
wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.bz2
tar xvf protobuf-2.5.0.tar.bz2
cd protobuf-2.5.0
./configure CC=clang CXX=clang++ CXXFLAGS='-std=c++11 -stdlib=libc++ -O3 -g' LDFLAGS='-stdlib=libc++' LIBS="-lc++ -lc++abi"
make -j 4
sudo make install
protoc --version
This file contains hidden or 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 enum | |
class Instruction(enum.Enum): | |
HLT = 0 | |
ADD = 1 | |
POP = 2 | |
PSH = 3 | |
SET = 4 | |
Get = 5 | |
JMP = 6 |
This file contains hidden or 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 <iostream> | |
using namespace std; | |
class Base1 { | |
public: | |
virtual void f() { cout << "Base1:f" << endl;} | |
virtual void g() { cout << "Base1::g" << endl;} | |
}; |
OlderNewer