Skip to content

Instantly share code, notes, and snippets.

View maowug's full-sized avatar
🏠
Working from whitehouse

u.go maowug

🏠
Working from whitehouse
View GitHub Profile
# # index.js
# var hello = require('./hello.coffee')
# console.log(hello());
assert = require 'power-assert'
exec = require('child_process').exec
cmd = 'node index.js'
<!doctype html>
<html>
<head>
<title>Self Camera</title>
</head>
<body>
<video id="myVideo" width="400" height="300" autoplay="1" ></video>
<script type="text/javascript">
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || window.navigator.mozGetUserMedia;
//練習問題:最初と最後の文字が同じアルファベットであるランダムな5文字の文字列を1000回出力。
new scala.util.Random(
new java.security.SecureRandom()
).alphanumeric
.grouped(5)
.withFilter { g5 => g5.head==g5.last && g5.head.toString >= "A" }
.take(10)
.foreach { vg5 => println(vg5.mkString) }
@maowug
maowug / gist:c3e66463f68e19a94ddb
Last active August 29, 2015 14:20
➜ src javap CASEPerson$ Compiled from "CASEPerson.scala"
public final class CASEPerson$ extends scala.runtime.AbstractFunction1<java.lang.String, CASEPerson> implements scala.Serializable {
public static final CASEPerson$ MODULE$;
public static {};
public final java.lang.String toString();
public CASEPerson apply(java.lang.String);
public scala.Option<java.lang.String> unapply(CASEPerson);
public java.lang.Object apply(java.lang.Object);
}
@maowug
maowug / gist:ca12155e3289e6a904f0
Last active August 29, 2015 14:20
CASEPerson.java
public class CASEPerson implements scala.Product,scala.Serializable {
public static scala.Option<java.lang.String> unapply(CASEPerson);
public static <A> scala.Function1<java.lang.String, A> andThen(scala.Function1<CASEPerson, A>);
public static <A> scala.Function1<A, CASEPerson> compose(scala.Function1<A, java.lang.String>);
public java.lang.String name();
public CASEPerson apply(java.lang.String);
public CASEPerson apply();
public CASEPerson copy(java.lang.String);
public java.lang.String copy$default$1();
public java.lang.String productPrefix();
@maowug
maowug / gist:9417fb5fe13e371448dc
Created April 14, 2015 09:53
sqrt under 1000
function isInt(n) {
return n % 1 === 0;
}
var i, j;
var count = 0;
var uniq_d = {}
for (i = 1000; i >= 3; i--) {
@maowug
maowug / _dataCleanning.py
Last active December 20, 2015 03:59
[07.24a] changes in _dataCleanning.py and survey.py
#!/usr/bin/env python
#encoding: utf-8
#__author__ = 'actor2019'
import csv
import cStringIO
import itertools
# with open('test.csv', 'rb') as csvfile:
# spamreader = csv.reader(csvfile, delimiter=',', quotechar='|')
@maowug
maowug / jp_9_removes_step1.py
Created July 6, 2013 11:24
possible duplicate form entries by Ngram.compare of forms of entries of same title
# possible duplicate form entries
# step2: if have multiple matches, continue ========== well-done 11k->7k
from ngram import NGram
for e in iter(jp.find({'pt':0})):
e_keys=e.get('forms',{}).keys()
if e.get('senses_ja') or e.get('senses'):
@maowug
maowug / jp_9_removes_todo.py
Last active December 19, 2015 10:19
remove entries marked with 'unknownFromNgram1' but `jp` have other entries matching their titles
# # todo: remove entries marked with 'unknownFromNgram1' but `jp` have other entries matching their titles
for e in iter(jp.find({'pt': "unknownFromNgram1"})):
res= list(jp.find({'title':e['title']}))
if len(res)>1:
print e['title'],e['_id']
if e.get('forms') or e.get('senses') or e.get('senses_ja'):
print u'mnf'
jp.remove(
{'_id':e['_id']}
@maowug
maowug / survey.py
Last active December 19, 2015 09:09
rule-generation-v1-without-ORdescriptor
#!/usr/bin/env python
#encoding: utf-8
from _dataCleanning import plCleaning
from _utilities import calCriteriaFromDC
def ruleGeneration(argWrapper, orDescriptors=None, dec=0):
if not orDescriptors: orDescriptors = []
dataWrapper=argWrapper