Skip to content

Instantly share code, notes, and snippets.

View jeremy886's full-sized avatar
🌴
moving to a country town

Jeremy Chen jeremy886

🌴
moving to a country town
  • Hamilton, VIC, Australia
View GitHub Profile
@jeremy886
jeremy886 / bingo.py
Last active August 29, 2015 14:07 — forked from matthiaseisen/bingo.py
# The MIT License (MIT)
#
# Copyright (c) 2014 Matthias Eisen (http://www.matthiaseisen.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@jeremy886
jeremy886 / a5_1.py
Last active August 29, 2015 14:13 — forked from ciscorn/a5_1.py
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import mm
c = canvas.Canvas("hello.pdf", pagesize=A4)
width, height = A4
numv = int((width - ((4 + 4) * mm)) / (5 * mm))
numh = int((height / 2.0 - ((12.5 + 2) * mm)) / (5 * mm))
voff = (width - numv * 5 * mm) / 2.0
# You don't need to use "import" for built-in fuctions when using them.
# We will see a few examples of frequently used built-in functions.
# You can see more here: https://docs.python.org/3/library/functions.html
# Built-in fuctions we have used so far.
# input()
name = input('Please type in your name: ')
# print()
print('Hello', name)
@jeremy886
jeremy886 / countryinfo.py
Created September 20, 2016 12:05 — forked from pamelafox/countryinfo.py
Python list of country codes, names, continents, capitals, and pytz timezones
countries = [
{'timezones': ['Europe/Andorra'], 'code': 'AD', 'continent': 'Europe', 'name': 'Andorra', 'capital': 'Andorra la Vella'},
{'timezones': ['Asia/Kabul'], 'code': 'AF', 'continent': 'Asia', 'name': 'Afghanistan', 'capital': 'Kabul'},
{'timezones': ['America/Antigua'], 'code': 'AG', 'continent': 'North America', 'name': 'Antigua and Barbuda', 'capital': "St. John's"},
{'timezones': ['Europe/Tirane'], 'code': 'AL', 'continent': 'Europe', 'name': 'Albania', 'capital': 'Tirana'},
{'timezones': ['Asia/Yerevan'], 'code': 'AM', 'continent': 'Asia', 'name': 'Armenia', 'capital': 'Yerevan'},
{'timezones': ['Africa/Luanda'], 'code': 'AO', 'continent': 'Africa', 'name': 'Angola', 'capital': 'Luanda'},
{'timezones': ['America/Argentina/Buenos_Aires', 'America/Argentina/Cordoba', 'America/Argentina/Jujuy', 'America/Argentina/Tucuman', 'America/Argentina/Catamarca', 'America/Argentina/La_Rioja', 'America/Argentina/San_Juan', 'America/Argentina/Mendoza', 'America/Argentina/Rio_Gallegos', 'America/Argentina/Ushuai
@jeremy886
jeremy886 / jupyter_shortcuts.md
Created December 28, 2016 01:54 — forked from kidpixo/jupyter_shortcuts.md
Keyboard shortcuts for ipython notebook 3.1.0 / jupyter

Toc

Keyboard shortcuts

The IPython Notebook has two different keyboard input modes. Edit mode allows you to type code/text into a cell and is indicated by a green cell border. Command mode binds the keyboard to notebook level actions and is indicated by a grey cell border.

MacOS modifier keys:

  • ⌘ : Command
__author__ = 'Jeremy Chen'
def merge_sort(unsorted):
sorted_ = []
length = len(unsorted)
if length == 1:
sorted_ = unsorted
def num_buses(n):
""" (int) -> int
Precondition: n >= 0
Return the minimum number of buses required to transport n people.
Each bus can hold 50 people.
>>> num_buses(75)
2
@jeremy886
jeremy886 / draw_text.py
Created June 3, 2017 07:40
draw chinese text using true type font
from PIL import (
Image,
ImageDraw,
ImageFont,
)
#SIZE = (100, 100)
base = Image.open('images/lena.png').convert('RGBA')
text = Image.new('RGBA', base.size, (255, 255, 255, 0))
# Chinese Fonts
@jeremy886
jeremy886 / p5js_test.html
Last active October 10, 2020 01:47
Brython p5.js test
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/p5@1.1.9/lib/p5.js"></script>
<script type="text/javascript"
src="https://cdn.rawgit.com/brython-dev/brython/master/www/src/brython.js">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/brython/3.8.10/brython.min.js" integrity="sha512-vaUMOYK2BF2hTTOXyvh7IoMaY6dDi7WkcywhsyX7XmASXxyZITWmsNK08VVQQwLrcsyGVXsypUNL/rbCeCpyLw==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/brython/3.8.10/brython_stdlib.min.js" integrity="sha512-CRKDjWdmHDkAJF/3fn4TFNRQkMybzRW41h92BUXM/n4bRMkOpfoO9t7saEw7BN/JstEu9LmYn0tTku+wY6jixw==" crossorigin="anonymous"></script>
@jeremy886
jeremy886 / dz[1].mathjax
Created August 27, 2017 05:46
deep learning equation
\begin{align*}
\frac{dL}{dz^{[1]}} = & \frac{dL}{da^{[1]}} \times \frac{da^{[1]}}{dz^{[1]}} \\
& = \frac{dz^{[2]}}{da^{[1]}} \frac{dL}{dz^{[2]}} \times \frac{da^{[1]}}{dz^{[1]}} \\
& = \frac{d(W^{[2]}{^T}a^{[1]})}{d a^{[1]}} {\bf dz^{[2]}} \times \frac{da^{[1]}}{dz^{[1]}} \\
& = W^{[2]}{^T} {\bf dz^{[2]}} \times \frac{da^{[1]}}{dz^{[1]}} \\
& = \frac{W^{[2]}{^T}}{dz^{[2]}} \times \frac{d}{dz^{[1]}}g^{[1]}(z^{[1]}) \\