Skip to content
View gist:1437b1af63ea5d8bc8fd
sudo apt-get install nodejs
sudo apt-get install npm
View java线程.md

Java线程与操作系统中轻量级进程是一一对应的关系。 为了实现并发,可以创建多个线程,如何管理这些线程,可使用线程池的方式。 当多个线程对同一资源进行访问时,可能会出现不一致的情况, 为了防止这种情况的发生可以使用锁的方式,或者当该资源是原子类时,也能保证同一时刻只有一个线程访问该资源。

View MyRequest.swift
import Foundation
import UIKit
class MyRequest {
class func get(url:String) -> RequestHandler {
return RequestHandler(url: url, method: "GET")
class func post(url:String) -> RequestHandler {
return RequestHandler(url: url, method: "POST")
cat ${filename} | while read line
echo `python -c "import sys, urllib as ul; print ul.unquote_plus('${line}')"`
View Mojolicious all routes
sub startup {
$app->helper(all_routes => \&_all_routes);
sub _all_routes {
my $self = shift;
my $route = shift || $self->app->routes;
$route = $self->app->routes->find($route) unless ( (ref $route) =~ m/Mojolicious::Routes/ );
#coding: utf-8
import numpy as np
import matplotlib.pyplot as plt
[1]『画像処理とパターン認識入門』酒井幸市 著
[2] scipy.fftpack.dct
View Array Shuffle
shuffle = function(v){
for(var j, x, i = v.length; i; j = parseInt(Math.random() * i), x = v[--i], v[i] = v[j], v[j] = x);
return v;
var a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
View gist:43a8ea51331d1af1df69
def root_to_numpy(base_object, field_name, attributes):
"""Convert objects stored in base_object.field_name to numpy array
Will query attributes for each of the objects in base_object.field_name
No, root_numpy does not do this for you, that's for trees...
objects_to_convert = getattr(base_object, field_name)
if not len(objects_to_convert):
return None
return np.array([tuple([getattr(p, pa) for pa in attributes]) for p in objects_to_convert])
View gist:4c2a47b499f357c7b3d7
; Stop animevent
if IsCreature
; Reset creature idle
Debug.SendAnimationEvent(ActorRef, "Reset")
Debug.SendAnimationEvent(ActorRef, "ReturnToDefault")
Debug.SendAnimationEvent(ActorRef, "FNISDefault")
Debug.SendAnimationEvent(ActorRef, "IdleReturnToDefault")
Debug.SendAnimationEvent(ActorRef, "ForceFurnExit")
if ResetAnim != "IdleForceDefaultState" && ResetAnim != ""
View describe_instances.rb
ec2 ='ap-southeast-1')
resp = ec2.describe_instances({filters: [{name:"tag:opsworks:stack", values:['qa-statemgmt-svc']}, {name:"tag:opsworks:layer:statemgmt_svc", values:['statemgmt_svc']}]})
resp = ec2.describe_instances({filters: [{name:"tag:opsworks:layer:statemgmt_svc", values:['statemgmt_svc']}]})
Something went wrong with that request. Please try again.