Skip to content

Instantly share code, notes, and snippets.

View ivanfoong's full-sized avatar

ivanfoong ivanfoong

View GitHub Profile
@ivanfoong
ivanfoong / make_pem.sh
Last active July 11, 2016 07:46
APNS pem file utilities
#!/bin/bash
openssl x509 -in "development.cer" -inform der -outform pem -out "development.cert.pem"
cat "development.cert.pem" "development.key.pem" > "development.pem"
openssl x509 -in "staging.cer" -inform der -outform pem -out "staging.cert.pem"
cat "staging.cert.pem" "staging.key.pem" > "staging.pem"
openssl x509 -in "production.cer" -inform der -outform pem -out "production.cert.pem"
cat "production.cert.pem" "production.key.pem" > "production.pem"
@ivanfoong
ivanfoong / text_classification.py
Created April 4, 2016 10:27
SKFlow text classification
# Copyright 2015-present Scikit Flow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@ivanfoong
ivanfoong / auth.proto
Last active April 2, 2016 07:54
gRPC example
syntax = "proto3";
option java_package = "com.ivanfoong.grpc.examples";
package auth;
service Authentication {
rpc Login(LoginRequest) returns (LoginResponse) {}
}
@ivanfoong
ivanfoong / Dockerfile
Last active March 23, 2016 07:56
Command line twitter search client
FROM alpine:3.3
RUN apk add --update ca-certificates
ADD search /bin/tweet-search
ENTRYPOINT ["/bin/tweet-search"]
CMD ["vonze21"]
@ivanfoong
ivanfoong / Dockerfile
Last active March 23, 2016 07:53
Command line twitter stream client
FROM alpine:3.3
RUN apk add --update ca-certificates
ADD stream /bin/tweet-stream
ENTRYPOINT ["/bin/tweet-stream"]
@ivanfoong
ivanfoong / tensorflow_notebook.sh
Last active February 25, 2016 08:13
Starting jupyter notebook with tensorflow docker
#!/bin/bash
mkdir /workspace
docker run -it --rm=true -v /workspace:/notebooks -p 8888:8888 b.gcr.io/tensorflow/tensorflow /run_jupyter.sh /notebooks

Build tensorflow on OSX with NVIDIA CUDA support (GPU acceleration)

These instructions are based on Mistobaan's gist but expanded and updated to work with the latest tensorflow OSX CUDA PR.

Requirements

OS X 10.10 (Yosemite) or newer

@ivanfoong
ivanfoong / coc_example.py
Created February 10, 2016 01:33
Clash of Clan API example
import urllib
import json
class Barcher(object):
"""
A simple client library for the Clash of Clans API in python
"""
def __init__(self, token):
import requests
self.requests = requests
@ivanfoong
ivanfoong / Stripe python snippets.md
Created January 21, 2016 07:15
Stripe python snippets
@ivanfoong
ivanfoong / image_read_and_plot.py
Last active December 14, 2015 06:24
Image operations in Python
import matplotlib.pyplot as pyplot
import numpy as np
import matplotlib.image as mpimg
import urllib2
%matplotlib inline
img_url = 'http://matplotlib.org/_images/stinkbug.png'
img = mpimg.imread(urllib2.urlopen(img_url))