Skip to content

Instantly share code, notes, and snippets.

nubela nubela

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am nubela on github.
  • I am nubela (https://keybase.io/nubela) on keybase.
  • I have a public key ASCwzBw3njPWLKuA2w5BtNxkDgS6Nteoqp3rwAqIHWHUZgo

To claim this, I am signing this object:

@nubela
nubela / nm_api.py
Last active Apr 26, 2018
Half-baked Python library for accessing NuMoney's API
View nm_api.py
import datetime
import json
import pyotp
import time
import requests
import action
from cfg import NUMONEY_OTP_SECRET, NUMONEY_API_ENDPOINT
@nubela
nubela / NMXClient.js
Created Apr 26, 2018
This is the JS library for accessing NuMoney Exchange's API
View NMXClient.js
// Sign requests using:
// https://tools.ietf.org/html/draft-cavage-http-signatures-09
import hmacSHA256 from 'crypto-js/hmac-sha256';
import sha256 from 'crypto-js/sha256';
import Base64 from 'crypto-js/enc-base64';
// Signed string be MUST be built from headers in this specific order
const SIGNATURE_HEADERS = [
"(request-target)", "host", "accept", "content-type", "x-original-length",
@nubela
nubela / gist:fa3439a47a378da8aced
Created Feb 12, 2015
MNIST/Pylearn2 Simple 2-layered MNIST runner
View gist:fa3439a47a378da8aced
import struct
import numpy as np
from pylearn2.utils import serial
import theano
def read_mnist_images():
path = "mnist/"
label_path = path + 't10k-images-idx3-ubyte'
dtype = 'float32'
@nubela
nubela / gist:c1a6a8b2e2425487c133
Created Feb 12, 2015
MNIST/Pylearn2 Simple 2-layer (Sigmod/Softmax) MLP trainer
View gist:c1a6a8b2e2425487c133
"""
This trains a simple 2-layered MLP for classifying handwritten digits (MNIST dataset)
For this script to work, you need to have a ./mnist folder that contains the MNIST dataset.
The dataset can be downloaded using the script in the following pylearn2 folder:
<workspace>/pylearn2/pylearn2/scripts/datasets/download_mnist.py
After training the model (neural network containing layers), it will save trained model to disk.
"""
@nubela
nubela / gist:5e917303aa2fb08d0b0a
Created Feb 11, 2015
2-layered MLP - xor problem
View gist:5e917303aa2fb08d0b0a
from random import randint
import numpy as np
from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix
from pylearn2.models import mlp
from pylearn2.termination_criteria import EpochCounter
from pylearn2.training_algorithms import sgd
import theano
def gen_xor_data():
@nubela
nubela / scraper.py
Created Nov 20, 2014
PropertyGuru scraper because why the f*ck do websites block copy paste?
View scraper.py
import json
from BeautifulSoup import BeautifulSoup
import requests
FILE_NAME = "result.txt"
BASE_URL = "http://www.propertyguru.com.sg/"
URL = "http://www.propertyguru.com.sg/singapore-property-listing/property-for-rent/%d?property_type=H" \
"&property_type_code[]=HDB&minprice=1500&maxprice=2500&minsize=1000&distance=0.5&center_lat=1" \
View Unsplash updater
import datetime
import random
from BeautifulSoup import BeautifulSoup
from base.util import generate_uuid
from homepage.app import homepage_db
from homepage.model import UnsplashImage
from homepage_cfg import EXPIRE_UNSPLASH_DAYS, UNSPLASH_IMAGE_DIR
import os
import requests
View join Javelin Beta
1) Join the Javelin Google+ community at https://plus.google.com/communities/106470412179443137104
2) Go to https://play.google.com/apps/testing/com.nubelacorp.javelin and accept being a beta tester
3) Wait about an hour, and check Google Play for a new update
View email.py
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib
from threading import Thread
from base_cfg import STMP_SERVER_HOST, SMTP_PASSWD, SMTP_USERNAME, FROM_EMAIL_NAME, FROM_EMAIL_ADDR
class Mail:
"""
You can’t perform that action at this time.