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'
View filco.shell
#!/bin/bash | |
setxkbmap -option caps:none | |
xmodmap -e "keycode 66 = End NoSymbol End NoSymbol End" | |
xmodmap -e "keycode 112 = BackSpace BackSpace BackSpace BackSpace" | |
View curl_check_ssl_version.cpp
#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; | |
} |
View multithread_http1_1_server.py
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)) |
View beijing_time.md
View Frequency linux command.md
find command with exclude
find -name "*.js" -not -path "./directory/*" -not -path "*thrift_gen/*"
remove duplicate column:
awk '!seen[$0]++' filename
View vim_shortcut.md
show diff between edit file and disk file
:w !diff % -
View upsource.sh
prepath=`dirname $PWD` | |
prepath=${prepath:16} | |
echo $(date) | |
echo "sshpass -p \"liuxiguang\"rsync -avr --delete ${PWD} phy:/home/liuxiguang/$prepath" | |
sshpass -p "liuxiguang" rsync -avr --delete --exclude=.git --exclude=.idea --exclude=.vscode --exclude=output ${PWD} phy:/home/liuxiguang/$prepath |
View Google protobuf installation on Mac.md
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
View vm.py
import enum | |
class Instruction(enum.Enum): | |
HLT = 0 | |
ADD = 1 | |
POP = 2 | |
PSH = 3 | |
SET = 4 | |
Get = 5 | |
JMP = 6 |
View derivce.cpp
#include <iostream> | |
using namespace std; | |
class Base1 { | |
public: | |
virtual void f() { cout << "Base1:f" << endl;} | |
virtual void g() { cout << "Base1::g" << endl;} | |
}; |
OlderNewer