Skip to content

Instantly share code, notes, and snippets.

View ereli's full-sized avatar

Ereli ereli

View GitHub Profile
@ereli
ereli / capturestill.py
Last active June 13, 2018 21:50
capture still images in python using pygame and fire
import time
from pathlib import Path
import pygame
import pygame.camera
from pygame.locals import *
import time
import fire
def show():
pygame.camera.init()
@ereli
ereli / bigquery_schema.py
Last active June 12, 2018 21:01 — forked from danielecook/bigquery_schema.py
Sense / infer / generate a big query schema string for import #bigquery from ndjson files.
import mimetypes
import sys
from collections import OrderedDict
filename = sys.argv[1]
def file_type(filename):
type = mimetypes.guess_type(filename)
return type
@ereli
ereli / build_opencv_ARM_cross
Last active June 10, 2018 17:09 — forked from hrshovon/build_opencv_ARM_cross
Cross compile opencv3.3.0 for your raspberry pi and similar ARM devices with python support
This is a note on how to cross compile opencv for pretty much any ARM device(HardFP supported in this case) and deploy. Native
compiling in ARM devices can be painfully slow and they seem to hang often during build(mine got stuck at 43%). So if you happen
to have a desktop/laptop/server running ubuntu or similar linux distro, u can build opencv in fractionth of the time taken for
native compiling without any issues.
Building opencv3 with TBB and NEON and VFP support can boost opencv performance. Thanks to Adrian at pyimagesearch for pointing
that out.
Both my PC and target machine aka orange pi zero are running ubuntu 16.04 with python2.7 and python 3.5.
Let us use the term "build machine" for your PC where you are building opencv and "target machine" for the ARM single board computer.
1.Run the following commands in both machines(I think installing these in target machine only would do) to install the necessary libraries etc.(mine worked with them,so they should be enough
@ereli
ereli / gist:084f9f4accb479e7cb33da9eb21411bb
Last active March 9, 2018 05:36
remove leading counts (numbers) and white spaces from the output of sort|uniq -c if you actually just want the values.
pbpaste |tr -d [0-9]| sed -e 's/^[[:space:]]*//'
@ereli
ereli / gist:cedb2e63d608885c7406c2a03ac129bc
Created February 21, 2018 19:53
Read data from Dynamodb in normal JSON format
aws dynamodb get-item --table-name='table_name' --key='{"id" : {"S":"12345"}}'|python3 -c 'import sys, json;from dynamodb_json import json_util as jt; data = json.load(sys.stdin); print(json.dumps(jt.loads(data)))'|jq .
@ereli
ereli / clean.py
Last active January 16, 2018 01:00
python script to clean stopwords from text and output words
#!/usr/bin/env python3
from sys import stdout
from nltk.corpus import stopwords
import fileinput
#import nltk
#nltk.download('stopwords')
stopword = stopwords.words('english')
@ereli
ereli / ubuntu16_tensorflow_cuda8.sh
Last active November 9, 2017 13:26 — forked from ksopyla/ubuntu16_tensorflow_cuda8.sh
How to set up tensorflow with CUDA 8 cuDNN 5.1 in virtualenv with Python 3.5 on Ubuntu 16.04 http://ksopyla.com/2017/02/tensorflow-gpu-virtualenv-python3/
# This is shorthened version of blog post
# http://ksopyla.com/2017/02/tensorflow-gpu-virtualenv-python3/
# Get cuda_8.0.61_375.26_linux.run and cudnn-8.0-linux-x64-v5.1.tgz
#
## update packages
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y install gcc make
@ereli
ereli / countries.sql
Last active March 28, 2024 06:40 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes. PostgreSQL compatible
CREATE SEQUENCE country_seq;
CREATE TABLE IF NOT EXISTS country (
id int NOT NULL DEFAULT NEXTVAL ('country_seq'),
iso char(2) NOT NULL,
name varchar(80) NOT NULL,
nicename varchar(80) NOT NULL,
iso3 char(3) DEFAULT NULL,
numcode smallint DEFAULT NULL,
phonecode int NOT NULL,
@ereli
ereli / .profile
Created June 1, 2017 18:11 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@ereli
ereli / gist:7b53789e53b1eabeba1a245e9a26036f
Created April 28, 2017 15:29 — forked from jagregory/gist:710671
How to move to a fork after cloning
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy.
* Off the top of my head *
1. Fork their repo on Github
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it
git remote add my-fork git@github...my-fork.git