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
#define ASSERT_NUM_EQ(lhs, rhs) \ | |
if ((lhs) != (rhs)) { \ | |
printf("Assert equal %s == %s failed\n", #lhs, #rhs); \ | |
printf("%s : %d, %s : %d\n", #lhs, lhs, #rhs, rhs); \ | |
kill(getpid(), SIGABRT); \ | |
} |
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
<snippet> | |
<content><![CDATA[ | |
#ifndef ${1:${3/.*/\U$&/}_} | |
#define $1 | |
$2 | |
#endif //${3:${TM_FILENAME/[\.\s\\\/()\[\]\{\}]+/_/g}} | |
]]></content> | |
<tabTrigger>defineguard</tabTrigger> | |
<scope>source.c++, source.c</scope> | |
</snippet> |
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<script type="text/javascript" src="jquery.js"></script> | |
<script type="text/javascript"> | |
var str = '1'; | |
for (var dup = 0; dup < 20; dup++) { | |
str += str; |
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/bash | |
### BEGIN INIT INFO | |
# Provides: redmine | |
# Required-Start: $local_fs $remote_fs $network | |
# Required-Stop: $local_fs $remote_fs $network | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: redmine webrick | |
# Description: redmine webrick server autostart-script | |
### END INIT INFO |
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 maxArea(vector<int> &height) { | |
// Start typing your C/C++ solution below | |
// DO NOT write int main() function | |
int area = (height.size() - 1) * ( (height.front() < height.back()) ? height.front() : height.back() ); | |
int i = 0, j = height.size() - 1; | |
while (i < j) { |
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
import sys | |
def parse(filename, limit): | |
freqs = [] | |
with open(filename) as f: | |
for l in f.readlines(): | |
l = l.strip().split() | |
freqs.append((float(l[1]), l[0])) | |
freqs.sort(reverse=True) | |
if limit > len(freqs): limit = len(freqs) |