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
# 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 |
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
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 |
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
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; |
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
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); |
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 <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> |
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
#!/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.' |
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
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 |
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 <iostream> | |
#include <vector> | |
using namespace std; | |
int find(vector<int> nums) { | |
if (nums.size() == 0) | |
return -1; | |
int value = nums[0]; | |
int count = 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
#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; |
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 <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; |
NewerOlder