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
// Copyright (c) 2012 Sutoiku, Inc. (MIT License) | |
// Some algorithms have been ported from Apache OpenOffice: | |
/************************************************************** | |
* | |
* Licensed to the Apache Software Foundation (ASF) under one | |
* or more contributor license agreements. See the NOTICE file | |
* distributed with this work for additional information | |
* regarding copyright ownership. The ASF licenses this file |
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 | |
tmux new-session -d -s dev -n fkgfw 'sslocal -v -c own.conf' | |
tmux new-window -n src -c '/data/project/src' | |
tmux new-window -n dist -c '/data/project/dist' | |
tmux new-window -n build -c '/data/project/src/build' | |
tmux new-window -n tmp -c '/home/kelvin/tmp' | |
tmux new-window -n vm1 'ssh ubuntu@192.168.2.101' | |
tmux new-window -n vm2 'ssh ubuntu@192.168.2.102' |
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 <memory> | |
#include <iostream> | |
#include <unordered_map> | |
// this is useful when dealing with google protobuf messages, what | |
// you get in your message callback is a google::protobuf::Message | |
// type, however, what you need is a concrete type, something like | |
// LoginRequest/LoginResponse, so you have to do the following: | |
// | |
// const LoginRequest *req = static_cast<const LoginRequest*>(msg); |
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
#!/usr/bin/env node | |
var fs = require('fs'); | |
var http = require('http'); | |
var request = require('request'); | |
var urlListFile = 'url.list'; | |
if (!fs.existsSync(urlListFile)) { |
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 <random> | |
typedef std::mt19937 EngineType; | |
typedef std::uniform_int_distribution<std::mt19937::result_type> GeneratorType; | |
bool GetIt(EngineType& engine, const GeneratorType& generator3, bool change) { | |
int correct_door = generator3(engine); | |
int first_choice = generator3(engine); |
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> | |
struct Origin { | |
int a; | |
}; | |
struct Wrapper { | |
Origin *orig; | |
Origin *operator->() const { | |
return orig; |
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 <stdio.h> | |
#include "share1.h" | |
#include "share2.h" | |
#include "static.h" | |
int main() { | |
printf("hello world\n"); | |
int a = 4; | |
int b = 2; | |
printf ("a: %d, b: %d\n", a, b); |
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 (list-add lst1 lst2) | |
(define (iter a1 a2 carry ret) | |
(cond ((and (null? a1) (null? a2)) | |
(if carry | |
(append ret '(1)) | |
ret)) | |
((null? a1) | |
(if carry | |
(iter '(1) a2 #f ret) | |
(append ret a2))) |
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/zsh | |
i=0 | |
while [ $i -le 800 ]; do | |
echo trying the $i times... | |
i=$(($i + 1)) | |
md5=$(curl http://yuyang.co/game/\?width\=$i\&k\=0eb46665addf43389ae950050f787a45 | md5sum) | |
#echo $md5 | |
if [ "$md5" != "c92e32594fd6558d6e1df9ab77daca42 -" ]; then | |
echo width is found: $i | |
break |
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 <algorithm> | |
#include <iostream> | |
using namespace std; | |
#define ARR_LEN(arr) (sizeof(arr) / sizeof(arr[0])) | |
struct element { | |
int id; | |
int score; |
NewerOlder