This file contains hidden or 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 [2015] <Yu Jing> | |
#include <cstdio> | |
#include <string> | |
#include <map> | |
using std::string; | |
using std::map; | |
char ch_searcher(const std::string & s) { |
This file contains hidden or 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: | |
void reverse(string &w) { | |
unsigned int len = w.length(); | |
for(unsigned int i = 0 ; i < len / 2 ; i ++ ) { | |
char t = w[i]; | |
w[i] = w[len - 1 - i]; | |
w[len - 1 - i] = t; | |
} | |
} |
This file contains hidden or 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 <cstdio> | |
#include <cstring> | |
#include <pthread.h> // thread | |
#include <unistd.h> // usleep | |
#include <string> | |
#include <mutex> // std::lock_guard , mutex | |
#include <queue> // queue |
This file contains hidden or 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
val json = net.liftweb.json.JsonParser.parse("[{\"foo\":1,\"bar\":2},{\"foo\":3,\"bar\":4}]") | |
implicit val formats = net.liftweb.json.DefaultFormats | |
case class Info(foo:Int,bar:Int) | |
val m = json.extract[List[Info]] | |
m.foreach{x=> println(x.foo+"|"+x.bar)} |
This file contains hidden or 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 <stdlib.h> | |
#include <string.h> | |
#include <string> | |
#include <vector> | |
#include <fstream> | |
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <arpa/inet.h> | |
#include <assert.h> |
This file contains hidden or 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
// usage : g++ thread_pool.cc -o tp -pthread --std=c++11 | |
// remove chrono header and timer, you may modify this file to c | |
// usage : gcc xxx.c -o tp_in_c -pthread --std=c99 | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#include <pthread.h> | |
#include <unistd.h> | |
#include <chrono> // for timer |
This file contains hidden or 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 com.argcv.util.mongo; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Properties; | |
import java.util.Set; |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<rexster> | |
<http> | |
<server-port>8182</server-port> | |
<server-host>0.0.0.0</server-host> | |
<base-uri>http://127.0.0.1</base-uri> | |
<web-root>public</web-root> | |
<character-set>UTF-8</character-set> | |
<enable-jmx>false</enable-jmx> | |
<enable-doghouse>true</enable-doghouse> |
This file contains hidden or 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
object Solution { | |
def main(args: Array[String]): Unit = { | |
val n = Console.in.readLine().toInt | |
val sl = (1 to n).map(i => (Console.in.readLine(),i)) | |
//io.Source.stdin.getLines().take(1).map(_.toInt) | |
println(math.abs(sl.par.foldLeft(0){(l,e) => | |
val i = e._2 - 1 | |
val arr = e._1.split(" ") | |
l + arr(i).toInt - arr(n - i - 1).toInt |
This file contains hidden or 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 org.aminer.io.utils | |
import scala.util.Try | |
import com.google.common.cache.CacheBuilder | |
import com.google.common.cache.CacheLoader | |
import com.google.common.cache.LoadingCache | |
//import com.google.common.cache.CacheBuilder | |
//import com.google.common.cache.CacheLoader |