- start tmux:
$ tmux
- exit tmux(detach):
//modified from https://github.com/felixge/node-formidable | |
var UPLOAD_DIR = "./"; | |
var PORT = 8000; | |
var formidable = require('formidable'), | |
http = require('http'), | |
util = require('util'); | |
var server = http.createServer(function(req, res) { | |
switch(req.url) { |
using System.Collections.Generic; | |
using System.Collections; | |
class Array | |
{ | |
public static void Main() | |
{ |
using System; | |
using System.Threading; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
class Time | |
{ | |
public static float deltaTime; | |
} |
using UnityEngine; | |
using System.Collections; | |
public class Plane : MonoBehaviour { | |
private Vector2 v = new Vector2(10, 10); | |
/* | |
private float radius = 50; | |
public float GetCircumference() | |
{ |
using UnityEngine; | |
using System.Collections; | |
public class TestCoroutine : MonoBehaviour { | |
public void Start() | |
{ | |
StartCoroutine("Co1"); | |
StartCoroutine("Kill"); | |
} |
#include "PerpetualCalendar.h" | |
int main() { | |
PerpetualCalendar c; | |
//assert(c.dayofweek(10, 3, 1493) == 4); | |
//assert(c.dayofweek(5, 20, 1493) == 1); | |
assert(c.dayofweek(7, 4, 1776) == 4); | |
assert(c.dayofweek(7, 14, 1789)== 2); | |
assert(c.dayofweek(6, 18, 1815)== 7); |
let a = [1, 2, 3, 4, 5]; | |
let index = 2; | |
let inc = i => i+1; | |
let dec = i => i-1; | |
let b = [...a.slice(0, index).map(inc), dec(a[index]), ...a.slice(index+1).map(inc)]; | |
console.log(`a=[${a}]`); | |
console.log(`b=[${b}]`); |
let a = [1, 2, 3, 4, 5]; | |
let index = 2; | |
let inc = amount => i => i + amount; | |
let dec = amount => i => i - amount; | |
let step = 1; | |
let b = [...a.slice(0, index).map(inc(step/(a.length-1))), dec(step)(a[index]), ...a.slice(index+1).map(inc(step/(a.length-1)))]; | |
let sum = (a, b) => a + b; | |
console.log(a); | |
console.log(a.reduce(sum)); | |
console.log(b); |
class Rotate { | |
public int[][] rotate(int[][] m, int s) { | |
if(m == null || m.length == 0) return m; | |
int w = m[0].length; | |
int h = m.length; | |
if(w == 1 || h == 1) return m; | |
for(int j=0; j<s; j++) { | |
int t1 = m[0][w-1]; |