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
package main | |
import ( | |
"bytes" | |
"context" | |
"flag" | |
"fmt" | |
// "os" | |
"path" |
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
// +build windows | |
package main | |
import ( | |
"fmt" | |
"time" | |
"syscall" | |
"unsafe" |
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
<html> | |
<body> | |
<script type="text/javascript" src="//mozilla.github.io/pdf.js/build/pdf.js"></script> | |
<script type="text/javascript"> | |
var url = "https://docs.google.com/document/export?format=pdf&id=1ML11ZyyMpnAr6clIAwWrXD53pQgNR-DppMYwt9XvE6s&token=AC4w5Vg7fSWH1Hq0SgNckx4YCvnGPaScyw%3A1423618416864"; | |
var pages = [], heights = [], width = 0, height = 0, currentPage = 1; | |
var scale = 1.5; | |
function draw() { |
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 java.util.Map; | |
import java.math.BigInteger; | |
import java.security.MessageDigest; | |
import java.io.*; | |
public class Pass | |
{ | |
public static void main(String[] arg) | |
{ | |
try { |
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
#pragma once | |
// Using Uninitialized Memory for Fun and Profit | |
// http://research.swtch.com/sparse | |
#include <vector> | |
class SparseSet | |
{ | |
private: | |
size_t n_; | |
std::vector<uint32_t> dense_, sparse_; |
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
template< class S> void print_with(S& s, char delim) {} | |
template< class S, typename T> void print_with(S& s, char delim, const T& t) { s<<t; } | |
template <class S, typename T, typename... Args> void print_with(S& s, char delim, const T& t, const Args& ...args) { s << t; if (delim) s << delim; print_with(s, delim, args...); } | |
template <typename... Args> | |
std::string to_string_with(char delim, const Args& ...args) { std::stringstream ss; print_with(ss, delim, args...); return ss.str(); } | |
template <typename... Args> std::string to_string(const Args& ...args) { return to_string_with('\x00', args...); } | |
template <typename... Args> std::ostream& print(std::ostream& out, const Args& ...args) { print_with(out, '\x00', args...); return out;} | |
template <typename... Args> std::ostream& println(std::ostream& out, const Args& ...args) { print_with(out, '\x00', args...); out << std::endl; return out;} |
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
// generate [0..n-1] | |
auto seq = [](size_t n) -> std::vector<size_t> { | |
std::vector<size_t> v(n); | |
for (size_t i=0; i<n; ++i) v[i] = i; | |
return v; | |
}; | |
auto index = seq(n); | |
// n * n distance matrix | |
std::vector<D> dists(n * n); |
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
// command line | |
//"/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py" -o js.pdf 0*.pdf | |
//quickfix css for angularjs.cn for printing | |
['ul.pagination', '.aside', '.footer', 'ul.user', '#comments', '#cnzz_stat_icon_1000062427'].forEach(function(e) {$(e).hide();}); | |
$('.pure-u-2-3').css("width", "100%"); | |
$('#main').css("background-color","#ffffff"); | |
$('pre.prettyprint').css('background-color', '#aaaaaa'); | |
$('.panel').css('-webkit-box-shadow', 'none'); |
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
#pragma once | |
#include <system_error> | |
namespace boost { namespace system { | |
using error_category = std::error_category; | |
using error_code = std::error_code; | |
using error_condition = std::error_condition; | |
using system_error = std::system_error; | |
using errc = std::errc; | |
using std::system_category; |
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
//copied from http://stackoverflow.com/questions/17424477/implementation-c14-make-integer-sequence | |
template<int...> struct seq { using type = seq; }; | |
template<typename T1, typename T2> struct concat; | |
template<int... I1, int... I2> struct concat<seq<I1...>, seq<I2...>>: seq<I1..., (sizeof...(I1) + I2)...> {}; | |
template<int N> struct gen_seq; | |
template<int N> struct gen_seq: concat<typename gen_seq<N/2>::type, typename gen_seq<N-N/2>::type>::type {}; | |
template <> struct gen_seq<0>: seq<>{}; | |
template <> struct gen_seq<1>: seq<0>{}; |
NewerOlder