Skip to content

Instantly share code, notes, and snippets.

View kachok's full-sized avatar

Dmitry Kachaev kachok

View GitHub Profile
@kachok
kachok / api-docs.json
Created January 12, 2015 19:49
Example of Swagger v2.0 API docs
{
"swagger": "2.0",
"info": {
"description": "This is a sample server Petstore server. \n\n[Learn about Swagger](http://swagger.wordnik.com) or join the IRC channel `#swagger` on irc.freenode.net. \n\nFor this sample, you can use the api key `special-key` to test the authorization filters\n",
"version": "1.0.0",
"title": "Swagger Petstore",
"termsOfService": "http://helloreverb.com/terms/",
"contact": {
"name": "apiteam@wordnik.com"
},
@kachok
kachok / register.sh
Created January 23, 2015 19:46
DRE registration
curl -H "Content-Type: application/json" -d '{ "username": "test9",
"password": "testtest",
"email": "test5@sad.com",
"firstName": "test",
"lastName": "five",
"dob": "1980-01-01",
"gender": "Female" }' http://localhost:3000/api/v1/register
@kachok
kachok / gist:1376975
Created November 18, 2011 16:35 — forked from defnull/gist:1224387
Deploy a Bottle app on Heroku
mkdir heroku
cd heroku/
virtualenv --no-site-packages env
source env/bin/activate
pip install bottle gevent
pip freeze > requirements.txt
cat >app.py <<EOF
import bottle
import os
@kachok
kachok / gist:1674638
Created January 25, 2012 04:03
Stats on bikes "hidden" moves in CaBi data
# "hidden" move - bike move started in bike station, different from the one where bike was actually left in previous trip
# 0 ['Duration', 'Start date', 'End date', 'Start station', 'End station', 'Bike#', 'Member Type']
# 1 ['0h 7min. 48sec.', '12/31/2011 23:55', '1/1/2012 0:03', '18th & M St NW (31221)', '10th & U St NW (31111)', 'W01319', 'Registered']
f=open ("2011-1st-quarter.csv")
tracking={}
member_types={}
total=0
@kachok
kachok / survey.html
Created March 21, 2012 01:15
HTML+JS for embedding Language Survey into MTurk questions
<!--
HTML+JS for embedding Language Survey into MTurk questions
Licensed under MIT/CC BY-SA 3.0 license
Use: replace FOREIGN with the name of foreign language
Requires JQuery library loaded in HEAD:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
@kachok
kachok / gitignore.py
Created April 14, 2012 16:00
python .gitignore
*.pyc
.project
.pydevproject
.settings/
build/
ISC License (ISC)
Copyright (c) 4-digit year, Company or Person's Name
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@kachok
kachok / tweets_es_pickleit.py
Created May 29, 2012 15:55
pickling of words from spanish tweets
import codecs
import pickle
file = "/Users/dkachaev/repos/hltcoe/tweets-es/data/oov.vocab"
out = codecs.open(file, "r", "utf-8")
vocab={}
@kachok
kachok / gist:3396898
Created August 19, 2012 18:22
Dictionaries dump
create table dictionary_dump_20120504 as
select l.prefix, v.id, v.word, vhr.translation, a.worker_id, p.quality, p.total
from voc_hits_results vhr, languages l, vocabulary v, assignments a, voc_hits_workers_performance p
where
a.id=vhr.assignment_id and
p.id=a.worker_id and p.language_id=l.id and
vhr.is_control=1 and vhr.quality=1
and v.id=vhr.word_id
and v.language_id=l.id