Skip to content

Instantly share code, notes, and snippets.

View logancyang's full-sized avatar
🎯
Focusing

Logan Yang logancyang

🎯
Focusing
View GitHub Profile
@logancyang
logancyang / space-colonization.js
Created July 28, 2020 22:07
A 2D version of space colonization algorithm in JavaScript
class Leaf {
constructor() {
this.pos = createVector(random(width), random(height));
this.reached = false;
}
show() {
fill(255, 255, 0);
noStroke();
ellipse(this.pos.x, this.pos.y, 8, 8);
class Tensor:
...
def backward(self):
# topological order all of the parents in the graph
topo = []
visited = set()
def build_topo(v):
if v not in visited:
visited.add(v)
for parent in v._prev:
class Tensor:
def __init__(self, data, _parents=(), _op=''):
self.data = data
self.grad = 0
self._backward = lambda: None
# A set that contains previous (parent) nodes that produced
# the current node with operation _op
self._prev = set(_parents)
self._op = _op
class Tensor:
def __init__(self, data, _parents, _op):
...
def sigmoid(self):
sigm = 1.0/(1 + np.exp(-self.data))
out = Tensor(sigm, _parents=(self,), _op="σ")
def _backward():
self.grad = sigm * (1 - sigm)
out._backward = _backward
return out
@logancyang
logancyang / 1-server.md
Created March 15, 2018 04:59 — forked from dragonjet/1-server.md
Setup Web Server on EC2 Amazon Linux AMI

Step 1: Server Credentials

This assumes you are now connected to the server via SSH.

  • sudo -s Enter root mode for admin access
  • groupadd devgroup Create new group to be later granted access to /var/www/html

Creating a new Root User

  • useradd -G root,devgroup masterdev Create new root user. Also add to the devgroup
  • passwd masterdev Change password for the new root user
  • At this point, you'll need to input your new root user's new password
@logancyang
logancyang / tmux-cheatsheet.markdown
Created December 19, 2017 23:23 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@logancyang
logancyang / beautiful_idiomatic_python.md
Last active August 29, 2015 14:25 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]: