Skip to content

Instantly share code, notes, and snippets.

package loader
import (
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
)
@rotemtam
rotemtam / csv_to_tfrecord.py
Created April 14, 2018 10:08
csv to tfrecord file
"""
Usage:
# From the data set dir
# Create train data:
python ../generate_tfrecord.py --csv_input=data/train_labels.csv --output_path=train.record
"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
@rotemtam
rotemtam / pascal_to_csv.py
Created April 14, 2018 09:49
pascal voc xml to csv table
import os
import glob
import pandas as pd
import xml.etree.ElementTree as ET
def xml_to_csv(path):
xml_list = []
for xml_file in glob.glob(path + '/*.xml'):
tree = ET.parse(xml_file)
@rotemtam
rotemtam / filter.sh
Created April 14, 2018 09:37
filter portrait images with imagemagick and bash
#!/bin/bash
for f in ./*.jpg
do
r=$(identify -format '%[fx:(h>w)]' "$f")
if [[ r -eq 1 ]]
then
rm "$f"
fi
done
@rotemtam
rotemtam / deployer.sh
Created March 8, 2017 07:48
deploy api gateway
python infra/api-gateway-deployer/src/__init__.py src/project.json
@rotemtam
rotemtam / api-gateway-swagger-example.js
Last active March 7, 2017 19:44
api gateway swagger example
{
"swagger": "2.0",
"info": {
"version": "2017-02-26T12:58:40Z",
"title": "SampleProject"
},
"host": "<host_id>.execute-api.us-east-1.amazonaws.com",
"basePath": "/dev",
"schemes": [
"https"
@rotemtam
rotemtam / apex+gateway.js
Last active March 7, 2017 19:30
Extending apex JSON files for API Gateway
{
"description": "search for github repos",
"x-api-gateway": {
"method": "post",
"path": "/repos/{id}",
"parameters":[
{
// configuration of input params. Skipped for brevity
// check out a real example: https://github.com/rotemtam/serverless-ci-example/blob/master/src/functions/getRepositories/function.json
}
@rotemtam
rotemtam / express-hello.js
Created March 6, 2017 15:06
Express.js Hello World
// Source: express.js website: https://expressjs.com/en/guide/routing.html
var express = require('express')
var app = express()
// respond with "hello world" when a GET request is made to the homepage
app.get('/', function (req, res) {
res.send('hello world')
})
@rotemtam
rotemtam / copy-backlog.md
Last active January 16, 2017 14:09
copy-backlog

Purpose

Get your copy backlog programatically.

Endpoint

https://console-api.atom-data.io/api/external/v1/copybacklog/:target_id/:schema_name/:table_name/?key=<api key>

Parameters

@rotemtam
rotemtam / apex-build.sh
Last active August 26, 2016 12:45
Build script
#!/bin/bash -e
PATH_TO_AWS_CREDENTIALS=~/.aws/credentials
AWS_REGION=us-east-1
# build the image
docker build . -t apex-lambda-deployer
# run unit tests
docker run apex-lambda-deployer npm test