Skip to content

Instantly share code, notes, and snippets.

View kachok's full-sized avatar

Dmitry Kachaev kachok

View GitHub Profile
@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 / 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"
},
# Run this once
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@kachok
kachok / google_translate.py
Created February 28, 2013 06:35
Sample google translate code. Put your Google API key into settings.py. Sample.txt format is tab separated language 2 letter code and word to translate, one pair per line. Get your key at https://code.google.com/apis/console/b/0/ It is $20 per 1,000,000 characters. Our words average 8 char per word. There is 8M chars per day limit.
# -*- coding: utf-8 -*-
from apiclient.discovery import build
from settings import settings
f=open("sample.txt","r")
for line in f:
lang, word = line.strip().split(" ")
# Build a service object for interacting with the API. Visit
@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
@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={}
The MIT License (MIT)
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION W
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 / gitignore.py
Created April 14, 2012 16:00
python .gitignore
*.pyc
.project
.pydevproject
.settings/
build/