Skip to content

Instantly share code, notes, and snippets.

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 April 26, 2018 02:58
Half-baked Python library for accessing NuMoney's API
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 April 26, 2018 02:17
This is the JS library for accessing NuMoney Exchange's API
// 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 February 12, 2015 08:53
MNIST/Pylearn2 Simple 2-layered MNIST runner
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 February 12, 2015 08:50
MNIST/Pylearn2 Simple 2-layer (Sigmod/Softmax) MLP trainer
"""
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 February 11, 2015 07:53
2-layered MLP - xor problem
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 November 20, 2014 16:13
PropertyGuru scraper because why the f*ck do websites block copy paste?
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" \
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
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
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:
"""