Skip to content

Instantly share code, notes, and snippets.

View z-a-f's full-sized avatar
🏠
Working from home

Zafar z-a-f

🏠
Working from home
  • Hoofs and Horns, Inc.
  • Mountain View, CA
View GitHub Profile
@z-a-f
z-a-f / index.html
Created January 19, 2015 23:31
Source for zafar.cc page
<!doctype html>
<html>
<head>
<title>Zafar's Test Page</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
@z-a-f
z-a-f / material_design_colors.xml
Created September 22, 2016 22:02
Material Design Colors
<?xml version="1.0" encoding="utf-8"?>
<!-- https://material.google.com/style/color.html -->
<resources>
<color name="colorPrimary">@color/indigo_primary</color>
<color name="colorPrimaryDark">@color/indigo_700</color>
<color name="colorAccent">@color/pink_A200</color>
<!-- Materials Themes -->
[alias]
a = add .
ai = add -i
#############
ap = apply
as = apply --stat
ac = apply --check
#############
ama = am --abort
amr = am --resolved
@z-a-f
z-a-f / 00-virtualenv.py
Created December 13, 2016 22:12
Running Jupyter Notebooks and IPython from Virtual Env
## Special thanks to http://stackoverflow.com/a/30650831/3606192
## Place this file under '~/.ipython/profile_default/startup/'
import os
import sys
if 'VIRTUAL_ENV' in os.environ:
py_version = sys.version_info[:2] # formatted as X.Y
py_infix = os.path.join('lib', ('python%d.%d' % py_version))
virtual_site = os.path.join(os.environ.get('VIRTUAL_ENV'), py_infix, 'site-packages')
#!/usr/bin/env python
import sys
"""
Convert any text to a set of HTML codes.
You can use it against email and phone number HTML parsers
"""
def htmlize(text):
assert(isinstance(text, str))
@z-a-f
z-a-f / .gitconfig
Last active August 31, 2017 17:30
git configuration bare minimum
[include]
path = .gitconfig_user
path = .gitconfig_alias
@z-a-f
z-a-f / fetch_all_assets.py
Last active July 15, 2017 02:02
RSS 2017 -- download all papers and presentations
#!/usr/bin/env python
from lxml import html, etree
import requests
import urllib
import re
from tqdm import tqdm
import sys, os
page = requests.get('http://www.roboticsconference.org/program/detailed/index.html')
@z-a-f
z-a-f / Ians_gans_02_2018.md
Last active April 14, 2019 02:07
Ian's GAN list 02/2018
import keras
def preprocess_images(images, normalization=255):
"""Normalizes the inputs"""
dims = images.shape
return images.reshape((dims[0], dims[1]*dims[2])).astype('float32') / normalization
def preprocess_labels(labels):
"""Preprocesses the labels into categorical"""
return keras.utils.to_categorical(labels)
import keras
# Get the data
(train_images, train_labels), (test_images, test_labels) = keras.datasets.mnist.load_data()
train_images = preprocess_images(train_images)
test_images = preprocess_images(test_images)
train_labels = preprocess_labels(train_labels)
test_labels = preprocess_labels(test_labels)
# Get the model
network = get_model()
# Fit the model