Skip to content

Instantly share code, notes, and snippets.

View azybler's full-sized avatar

Hao Wooi Simon Lim azybler

View GitHub Profile

Keybase proof

I hereby claim:

  • I am azybler on github.
  • I am haowooilim (https://keybase.io/haowooilim) on keybase.
  • I have a public key ASD1QMoPhA0KvzyA5N4RGXCrogVrn6yq8AOVReqH_bUzcAo

To claim this, I am signing this object:

@azybler
azybler / train.py
Created January 13, 2019 06:51
Runnable Convolutional NN training script (trains on CIFAR-10 dataset)
'''Train a simple deep CNN on the CIFAR10 small images dataset.
'''
from __future__ import print_function
import keras
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten, Conv2D, MaxPooling2D
import os
@azybler
azybler / train.py
Created January 13, 2019 05:09
Runnable Effnet training script (trains on CIFAR-10 dataset)
'''Train a EffNet CNN on the CIFAR10 small images dataset.
https://towardsdatascience.com/3-small-but-powerful-convolutional-networks-27ef86faa42d
'''
from __future__ import print_function
import keras
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Model
@azybler
azybler / facebook_leads.md
Last active June 27, 2016 06:36 — forked from tixastronauta/facebook_leads.md
Receiving Facebook Leads on a Webhook

Receiving Facebook Leads on a Webhook

1 - Create an App

Head over to developer.facebook.com and create an App

2 - Setup the webhook

On your server, create a facebook webhook that will handle facebook calls. Then create a "leadgen" webhook on you App: https://developers.facebook.com/docs/graph-api/webhooks/v2.6

@azybler
azybler / gist:11168942
Last active August 29, 2015 14:00
Refactor jquery ui datepicker code from .each to .filter & .map
// before
var schedulesTmp = $('form#interview-schedule input[name^="schedule-datetime"]');
var schedules1 = [];
schedulesTmp.each(function() {
if (null !== $(this).datepicker('getDate')) {
schedules1.push($(this).val());
}
});
alert(schedules1.length + ' ' + schedules1[0] + ' ');
@azybler
azybler / gist:9978017
Created April 4, 2014 16:18
Demonstrating Adapter pattern (aka wrapper pattern) in JavaScript.
function OldLogger (type) {
this.writeToLog = function(message) {
//To stuff.
};
}
function NewLogger (type) {
this.doLog = function(message) {
//To stuff.
};
@azybler
azybler / gist:9978002
Created April 4, 2014 16:17
Demonstrating Bridge Pattern in Java
/** "Implementor" */
interface DrawingAPI {
public void drawCircle(double x, double y, double radius);
}
/** "ConcreteImplementor" 1/2 */
class DrawingAPI1 implements DrawingAPI {
public void drawCircle(double x, double y, double radius) {
System.out.printf("API1.circle at %f:%f radius %f\n", x, y, radius);
}
@azybler
azybler / gist:9977808
Created April 4, 2014 16:07
Some useful JavaScript helper functions.
!function(window, document, undefined) {
var toStr = Object.prototype.toString;
window.SJ = {
// Check if the variable is an array.
IsArr: function(obj) {
return toStr.call(obj) === '[object Array]';
},
// Check if the variable is a function.
IsFunc: function(obj) {
@azybler
azybler / gist:9977709
Last active August 29, 2015 13:58
Pooling-based Notification sample JavaScript code.
var baseUrl = 'http://www.test.com/';
var Notification = {
ajaxFrontendLock: false, // to block user-triggered ajax call.
ajaxBackendLock: false, // to block backend-triggered ajax call.
ajaxTimeout: 5000, // 5 seconds.
getListUrl: baseUrl + 'notifications/get-list/',
getUnreadCountUrl: baseUrl + 'notifications/get-unread-count/',
getNewCountPoolingInterval: 10000), // 10 seconds.
markAsReadUrl: baseUrl + 'notifications/mark-as-read/',
notificationBtn: 'a#notification-popover-toggle',
var http = require('http');
var Chimera = require('chimera').Chimera;
var fs = require('fs');
var c = new Chimera();
var server = http.createServer(function(req, res) {
if (req.method === 'GET' && req.url === '/') {
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end(" \
<html> \