Skip to content

Instantly share code, notes, and snippets.

@showyou
showyou / fileserver.py
Created December 12, 2010 15:59
test program of flask
import sys
from flask import Flask,request,render_template, g, flash, send_from_directory
import datetime
import locale
from sqlite3 import dbapi2 as sqlite3
from werkzeug import secure_filename
DATABASE = "./tmp/fileserver.db"
TMP_FOLDER = "./tmp/"
app = Flask(__name__)
@mohamedmansour
mohamedmansour / gist:803631
Created January 31, 2011 04:11
Get and Set localStorage from Content Script
// Content Script to save data.
chrome.extension.sendRequest({storage: 'foo', value: 'bar'});
// Content Script to get data.
chrome.extension.sendRequest({storage: 'foo'}, function(response) {
console.log('foo => ' + response.storage);
});
// Background Page
@mbostock
mbostock / .block
Last active June 11, 2018 03:00
Asynchronous Queue
license: gpl-3.0
@Salinger
Salinger / mecab_test.py
Created January 17, 2013 10:24
MeCabの動作確認用。
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import MeCab
m = MeCab.Tagger("-Ochasen")
string = u"それサバンナでも同じ事言えんの?"
# MeCabでUnicode文字列を扱う場合は、一度エンコードする必要がある。
# この際、
# node = tagger.parseToNode(string.encode("utf-8"))
@Shinpeim
Shinpeim / 00.md
Last active January 16, 2020 13:08
Scala 入学式の資料

Better Java としての Scala

Hello World

  • src/main/scala/Main.scala
object Main {
  def main(args: Array[String]): Unit = {
    println("hello scala!")
@rike422
rike422 / gist:7096675
Created October 22, 2013 07:48
casper.js使い方

casper.jsとは

CasperJS is an open source navigation scripting & testing utility written in Javascript for the PhantomJS WebKit headless browser and SlimerJS (Gecko). It eases the process of defining a full navigation scenario and provides useful high-level functions, methods & syntactic sugar for doing common tasks such as:

参考資料

コマンド

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
import codecs
import numpy as np
import MeCab
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.cluster import KMeans, MiniBatchKMeans
anonymous
anonymous / gist:8079281
Created December 22, 2013 07:00
function google() {
local str opt
if [ $# != 0 ]; then # 引数が存在すれば
for i in $*; do
str="$str+$i"
done
str=`echo $str | sed 's/^\+//'` #先頭の「+」を削除
opt='search?num=50&hl=ja&ie=euc-jp&oe=euc-jp&lr=lang_ja'
opt="${opt}&q=${str}"
fi
@finaiized
finaiized / union-find.py
Created June 15, 2014 03:04
Implements various algorithms for union find, based on Algorithms, Part I
class QuickFind(object):
"""
Implements the quick find algorithm for the dynamic connectivity problem
Cost model (in array read/writes):
Initialization: N
Union: N
Find: 1
Algorithm:
@cocodrips
cocodrips / CODERUNNER_Cluster
Last active August 29, 2015 14:10
CodeRunner 予選Bの敵の属性をK-meansで分類したやつ
0 : ( 24 48 68 73 74 89 99 )
1 : ( 20 34 46 47 54 71 78 )
2 : ( 6 13 14 16 23 25 28 29 30 37 41 43 50 51 53 55 58 59 60 61 65 66 69 70 72 75 79 83 84 85 86 88 90 92 94 97 )
3 : ( 1 7 15 26 33 36 38 64 76 80 81 91 96 100 )
4 : ( 3 17 35 44 45 52 67 77 )
5 : ( 9 10 21 27 87 )
6 : ( 4 62 82 95 98 )
7 : ( 5 18 31 39 40 56 )
8 : ( 8 12 22 32 42 57 63 )
9 : ( 2 11 19 49 93 )