Skip to content

Instantly share code, notes, and snippets.

View yuikns's full-sized avatar

Yu yuikns

  • 09:04 (UTC +08:00)
View GitHub Profile
#!/bin/sh
# this bash is base on https://developer.github.com/v3/users/keys/#create-a-public-key
username='yourname'
password='yourpassword'
id_to_delete='123'
curl -X DELETE https://api.github.com/user/keys/$id_to_delete -u "$username:$password"
import pip
from subprocess import call
for dist in pip.get_installed_distributions():
call("pip install --upgrade " + dist.project_name, shell=True)
package com.argcv.demo;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class MultiThreadDemo {
int counter = 0;
public class InsertThread extends Thread {
public void insertBatch(List<AcmAuthor2paper> objList) {
String sql = String.format("INSERT INTO %s.author2paper(id,aid,pid,position) VALUES (?,?,?,?)", dbName);
DBConnection conn = pool.getConnection();
PreparedStatement ps = null;
try {
conn.setAutoCommit(false);
ps = conn.prepareStatement(sql);
for (AcmAuthor2paper obj : objList) {
_constructPS(ps, obj);
// for http://fun.coolshell.cn/unix.html
#include <stdio.h>
#include <string.h>
int main()
{
char * seq1 = "pvwdgazxubqfsnrhocitlkeymj";
char seq[32] = "";
for(int i = 0 ; i < strlen(seq1) ; i ++)
{
# Dropbox
108.160.165.62 dropbox.com
108.160.166.62 dropbox.com
108.160.167.205 www.dropbox.com
23.21.206.219 forums.dropbox.com
23.23.104.199 dl.dropboxusercontent.com
108.160.166.189 d.dropbox.com
108.160.166.12 client-lb.dropbox.com
204.236.220.7 dl-client1.dropbox.com
204.236.220.9 dl-client2.dropbox.com
/**
* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createE
<?php
/*
Author: Jim Westergren & Jeedo Aquino
File: index-with-redis.php
Updated: 2012-10-25
This is a redis caching system for wordpress.
see more here: www.jimwestergren.com/wordpress-with-redis-as-a-frontend-cache/
@yuikns
yuikns / hello_leveldb.cc
Last active August 29, 2015 14:03
leveldb
// get start from http://leveldb.googlecode.com/svn/trunk/doc/index.html
#include <iostream>
#include <algorithm>
#include <string>
#include "leveldb/db.h"
#include "leveldb/cache.h"
#include "leveldb/options.h"
int main()
{
@yuikns
yuikns / MersenneTwister.h
Last active August 29, 2015 13:58
Mersenne Twister random number generator -- a C++ class MTRand
// MersenneTwister.h
// Mersenne Twister random number generator -- a C++ class MTRand
// Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus
// Richard J. Wagner v1.1 28 September 2009 [email protected]
// The Mersenne Twister is an algorithm for generating random numbers. It
// was designed with consideration of the flaws in various other generators.
// The period, 2^19937-1, and the order of equidistribution, 623 dimensions,
// are far greater. The generator is also fast; it avoids multiplication and
// division, and it benefits from caches and pipelines. For more information