Skip to content

Instantly share code, notes, and snippets.

View kachok's full-sized avatar

Dmitry Kachaev kachok

View GitHub Profile
@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
# Run this once
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@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