Skip to content

Instantly share code, notes, and snippets.

View datlife's full-sized avatar

Dat Nguyen datlife

View GitHub Profile
'''Train MNIST with tfrecords yielded from a TF Dataset
In order to run this example you should first run 'mnist_to_tfrecord.py'
which will download MNIST data and serialize it into 3 tfrecords files
(train.tfrecords, validation.tfrecords, and test.tfrecords).
This example demonstrates the use of TF Datasets wrapped by a generator
function. The example currently only works with a fork of keras that accepts
`workers=0` as an argument to fit_generator, etc. Passing `workers=0` results
in the generator function being run on the main thread (without this various
@0xjac
0xjac / private_fork.md
Last active December 11, 2024 04:19
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@bzamecnik
bzamecnik / keras_input_reshape.py
Last active June 28, 2018 08:15
Reshaping input data for convolution in Keras
# In Keras the Convolution layer requirest an additional dimension which will be used for the various filter.
# When we have eg. 2D dataset the shape is (data_points, rows, cols).
# But Convolution2D requires shape (data_points, rows, cols, 1).
# Otherwise it fails with eg. "Exception: Input 0 is incompatible with layer convolution2d_5: expected ndim=4, found ndim=3"
#
# Originally I reshaped the data beforehand but it only complicates things.
#
# An easier and more elegant solution is to add a Reshape layer at the input
# of the network!
#
@fchollet
fchollet / classifier_from_little_data_script_3.py
Last active July 23, 2024 16:32
Fine-tuning a Keras model. Updated to the Keras 2.0 API.
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
@ejcx
ejcx / top-700k.json
Created February 24, 2016 09:37
Alexa Top 700k Survey
{"":"","HTTP/1.1 200 OK":"","access-control-allow-credentials":"true","access-control-allow-origin":"http://evil.com.ej.cx","cache-control":"no-store, no-cache, must-revalidate, post-check=0, pre-check=0","content-type":"text/html","date":"wed, 24 feb 2016 01:17:21 gmt","expires":"thu, 19 nov 1981 08:52:00 gmt","pragma":"no-cache","server":"apache/2.2.22 (ubuntu)","set-cookie":"phpsessid=2phdir1nkjt822p5lelc2vtf65; path=/","vary":"accept-encoding","x-hostname":"http://.ej.cx","x-powered-by":"php/5.3.10-1ubuntu3.21"}
{"":"","HTTP/1.1 302 Found":"","access-control-allow-credentials":"true","access-control-allow-methods":"get, head, post, put, patch, delete, options","access-control-allow-origin":"https://wetransfer.com.evil.com","access-control-expose-headers":"","access-control-max-age":"60","cache-control":"no-cache","connection":"keep-alive","content-type":"text/html; charset=utf-8","date":"wed, 24 feb 2016 01:17:55 gmt","location":"https://www.wetransfer.com/","server":"nginx","status":"302 found","vary":"o
@raelgc
raelgc / Install MSOffice on Ubuntu.md
Last active February 26, 2024 03:10
Install MSOffice on Ubuntu

Install Microsoft Office 2010 on Ubuntu

Requirements

We'll install MSOffice using the PlayOnLinux wizard. Additionally, MSOffice requires samba and winbind to properly work.

So, if not installed, install them:

sudo apt-get install playonlinux samba winbind
@Chaser324
Chaser324 / GitHub-Forking.md
Last active December 11, 2024 07:53
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@ogrrd
ogrrd / dnsmasq OS X.md
Last active December 9, 2024 10:13
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install

@kencoba
kencoba / Builder.scala
Created February 21, 2012 05:43
Builder pattern (Design patterns in Scala)
abstract class Product
abstract class PizzaBuilder {
var dough: String
var sauce: String
var topping: String
def withDough(dough: String): PizzaBuilder
def withSauce(sauce: String): PizzaBuilder
def withTopping(topping: String): PizzaBuilder