Skip to content

Instantly share code, notes, and snippets.

View yshean's full-sized avatar

Yong Shean yshean

  • Comerge Solutions
  • Kuala Lumpur, Malaysia
  • X @shin_chong
View GitHub Profile
@yshean
yshean / load-test.sh
Last active August 29, 2015 14:25
Load testing dataset for slice 1_01
#!/bin/bash
# This is an example of loading test dataset for slice 1_01
# This will serve as a template for loading test dataset for other slices
# Require load-images-test.lua to be hosted on S3
# After this run load-test-slice.sh for each of the other slices
slice='1_01'
cd ~/demos/load-data
@yshean
yshean / keras_ae.py
Created December 17, 2015 12:49
Keras with Theano backend: This is a working example of autoencoder training on MNIST dataset.
n_in = 784
n_hid = 392
n_out = n_in
batch_size = 64
nb_epoch = 10
learning_rate = 1e-3
from keras.datasets import mnist
import numpy as np
(X_train, y_train), (X_test, y_test) = mnist.load_data()
@yshean
yshean / shear_and_rotate.py
Created April 27, 2017 07:09
Data augmentation using shear and rotate within a range.
def shear_and_rotate(image_path, img_w, img_h):
from skimage.io import imread, imsave
from skimage.transform import resize
from skimage import transform as transf
import numpy as np
from skimage.filters import threshold_otsu
from scipy.ndimage.interpolation import rotate
import math
image = imread(image_path)
@yshean
yshean / main_initial.dart
Last active June 1, 2020 03:52
Simple TextField setup for address input
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
@yshean
yshean / main_with_search.dart
Last active June 1, 2020 03:54
TextField setup for address input v2
import 'package:flutter/material.dart';
import 'package:google_places_flutter/address_search.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
@yshean
yshean / address_search_v1.dart
Created June 1, 2020 04:07
Address search v1
import 'package:flutter/material.dart';
class AddressSearch extends SearchDelegate<Suggestion> {
@override
List<Widget> buildActions(BuildContext context) {
return [
IconButton(
tooltip: 'Clear',
icon: Icon(Icons.clear),
onPressed: () {
@yshean
yshean / place_service_v1.dart
Created June 1, 2020 04:19
Place service v1 with autocomplete
import 'dart:convert';
import 'dart:io';
import 'package:http/http.dart';
// For storing our result
class Suggestion {
final String placeId;
final String description;
import 'package:flutter/material.dart';
import 'package:google_places_flutter/address_search.dart';
import 'package:google_places_flutter/place_service.dart';
import 'package:uuid/uuid.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
import 'dart:convert';
import 'dart:io';
import 'package:http/http.dart';
class Place {
String streetNumber;
String street;
String city;
String zipCode;
import 'package:flutter/material.dart';
import 'package:google_places_flutter/address_search.dart';
import 'package:google_places_flutter/place_service.dart';
import 'package:uuid/uuid.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {