Skip to content

Instantly share code, notes, and snippets.

View ayee's full-sized avatar

Anthony Yee ayee

View GitHub Profile
@ayee
ayee / LearningKubernetesNotes.md
Created June 30, 2020 00:51
Notes to Learning Kubernetes

Hello

Create authentication token

Step 1: Get user to create token for

django.contrib.auth.models.User.objects.all() return error AttributeError: Manager isn't available; 'auth.User' has been swapped for 'users.User'

from django.contrib.auth import get_user_model
In [5]: get_user_model()
Out[5]: socgram.users.models.User
In [8]: get_user_model().object.all()
@ayee
ayee / ca_fields.yaml
Created December 13, 2017 06:56
ca_fields.yaml
card_no:
x: 392
y: 118
w: 227
h: 48
binarize: false
date_of_expiry:
x: 413
y: 195
@ayee
ayee / InstallOpenCViOS.md
Last active January 25, 2021 23:21
How to Install opencv for iOS on OSX
  1. Install cmake
  2. Add to cmake to PATH
PATH=$PATH:/Applications/CMake.app/Contents/bin
  1. Clone OpenCV repository
cd ~/<my_working _directory>
git clone https://github.com/opencv/opencv.git
@ayee
ayee / zeppelin-env-config.json
Last active March 8, 2017 23:54
This file is used to change configuration of Zeppelin started along with EMR Spark cluster.
[
{
"Classification": "zeppelin-env",
"Properties": {
},
"Configurations": [
{
"Classification": "export",
"Properties": {
@ayee
ayee / python-tesseract-install-macox.md
Last active December 2, 2016 04:11
How to install python-tesseract wrapper for SimpleCV
@ayee
ayee / card_perspective_correct.cpp
Last active October 11, 2016 18:24
Sample code to automatically correct perspective of a card image using OpenCV
Mat src=imread("card.jpg");
Mat thr;
cvtColor(src,thr,CV_BGR2GRAY);
threshold( thr, thr, 70, 255,CV_THRESH_BINARY );
vector< vector <Point> > contours; // Vector for storing contour
vector< Vec4i > hierarchy;
int largest_contour_index=0;
int largest_area=0;
@ayee
ayee / gist:494bd2efcce0772c908a28869612814e
Created September 3, 2016 06:26 — forked from filipbec/gist:5998034874b119fab0e4
Scannr - Keys for obtaining US Driver's license data
@ayee
ayee / pyspark-split-dataframe-column-literal.py
Created December 21, 2015 23:03
Split Spark dataframe columns with literal
from pyspark.sql.functions import split
df = sc.parallelize([[1, 'Foo:10'], [2, 'Bar:11'], [3,'Car:12']]).toDF(['Event', 'eventtype'])
df = df.withColumn('Thing', split(df.eventtype, ':')[0])
df = df.withColumn('Ranking', split(df.eventtype, ':')[1])
df.collect()
# [Row(Event=1, eventtype=u'Foo:10', Thing=u'Foo', Ranking=u'10'),
# Row(Event=2, eventtype=u'Bar:11', Thing=u'Bar', Ranking=u'11'),
# Row(Event=3, eventtype=u'Car:12', Thing=u'Car', Ranking=u'12')]
@ayee
ayee / 0_reuse_code.js
Last active August 29, 2015 14:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console