Skip to content

Instantly share code, notes, and snippets.

# Setting the prefix from C-b to C-a
set -g prefix C-a
# Free the original Ctrl-b prefix keybinding
unbind C-b
# Setting the delay between prefix and command
set -s escape-time 1
# Set the base index for windows to 1 instead of 0
set -g base-index 1
@chenyanzhe
chenyanzhe / Sublime Text 3 Build 3103 License Key - CRACK
Created September 1, 2016 08:59
Sublime Text 3 Build 3103 License Key - CRACK
I use the first
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
@chenyanzhe
chenyanzhe / style.css
Last active March 23, 2018 22:53
马克飞象自定义渲染CSS
body {
font-family: "Avenir Next", Helvetica, Arial, sans-serif;
padding:1em;
margin:auto;
max-width:42em;
background:#fefefe;
}
h1, h2, h3, h4, h5, h6 {
font-weight: bold;
class Solution {
public:
int coinChange(vector<int>& coins, int amount) {
if (amount <= 0) return 0;
// filter and fast path
vector<int> items;
for (auto c : coins) {
if (c < amount)
items.push_back(c);
@chenyanzhe
chenyanzhe / Network.cpp
Created January 8, 2016 03:21 — forked from mkroman/Network.cpp
Uncrustify configuration inspired by Google's C++ styleguide.
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
#include <string.h>
#include <iostream>
#include <stdarg.h>
#include <stdio.h>
@chenyanzhe
chenyanzhe / connection-test
Last active September 25, 2015 03:11
Check network connection status.
#!/bin/sh
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
wget --spider --quiet www.google.co.jp
if [ "$?" == "0" ]; then
echo '['$LOGTIME'] No Problem.'
exit 0
else
wget --spider --quiet www.baidu.com
if [ "$?" == "0" ]; then
echo '['$LOGTIME'] Problem decteted, restarting.'
@chenyanzhe
chenyanzhe / updatelist
Created September 25, 2015 02:35
Update router list for chinadns and shadowsocks
updatelist() {
wget -O- 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' | awk -F\| '/CN\|ipv4/ { printf("%s/%d\n", $4, 32-log($5)/log(2)) }' > /tmp/ignore.list
cp /tmp/ignore.list /etc/chinadns_chnroute.txt
cp /tmp/ignore.list /etc/shadowsocks_ignore.list
}
updatelist
@chenyanzhe
chenyanzhe / find.cpp
Created September 14, 2015 14:02
[腾讯笔试] 2016腾讯校招技术类笔试(大题部分) 第四题
#include <iostream>
#include <vector>
using namespace std;
int find(vector<int> nums) {
if (nums.size() == 0)
return -1;
int value = nums[0];
int count = 1;
@chenyanzhe
chenyanzhe / solver.cpp
Created September 14, 2015 13:45
[腾讯笔试] 2016腾讯校招技术类笔试(大题部分) 第二题
#include <iostream>
using namespace std;
int main() {
int a, b, c, d, e, f, g, h;
for (a = 0; a <= 4; a++) {
b = 13 - a;
for (e = 0; e <= 5; e++) {
h = 5 - e;
@chenyanzhe
chenyanzhe / merge_sort_iterative.cpp
Created September 13, 2014 08:20
Merge Sort Iterative Version
#include <iostream>
#include <vector>
#include <limits>
using namespace std;
void merge(vector<int> & data, int p, int q, int r) {
// merge data[p..q] and data[q+1..r]
int n1 = q - p + 1;
int n2 = r - q;