Skip to content

Instantly share code, notes, and snippets.

View superposition's full-sized avatar

Eric Manganaro superposition

View GitHub Profile
import types
import tensorflow as tf
import numpy as np
# Expressions are represented as lists of lists,
# in lisp style -- the symbol name is the head (first element)
# of the list, and the arguments follow.
# add an expression to an expression list, recursively if necessary.
def add_expr_to_list(exprlist, expr):

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@superposition
superposition / erc721-example.sol
Created January 17, 2018 18:14 — forked from aunyks/erc721-example.sol
My implementation of the ERC721 token standard. WARNING: THIS CODE IS FOR EDUCATIONAL PURPOSES. DO NOT DEPLOY TO THE NETWORK.
pragma solidity ^0.4.19;
contract ERC721 {
string constant private tokenName = "My ERC721 Token";
string constant private tokenSymbol = "MET";
uint256 constant private totalTokens = 1000000;
mapping(address => uint) private balances;
mapping(uint256 => address) private tokenOwners;
mapping(uint256 => bool) private tokenExists;
mapping(address => mapping (address => uint256)) private allowed;
mapping(address => mapping(uint256 => uint256)) private ownerTokens;
@superposition
superposition / Django_ReactJS_Webpack_project_setup.md
Created February 15, 2018 19:28 — forked from Belgabor/Django_ReactJS_Webpack_project_setup.md
Set up a Django + ReactJS project with Webpack manager

Guide on how to create and set up your Django project with webpack, npm and ReactJS :)

Hopefully this will answer "How do I setup or start a Django project?" I was trying to set up my own website, and there was a lot to read, learn and digest! Therefore, I put this together which is a collection of all the guides/blog posts/articles that I found the most useful. At the end of this, you will have your barebones Django app configured and ready to start building :)

NOTE: This guide was built using Django 1.9.5, NodeJS 4+ with NPM 3+

1. Setting up your dev environment

@superposition
superposition / LambdaBase.py
Created April 17, 2018 05:11 — forked from benkehoe/LambdaBase.py
Code pattern for implementing class-based AWS Lambda handlers in Python
"""Base class for implementing Lambda handlers as classes.
Used across multiple Lambda functions (included in each zip file).
Add additional features here common to all your Lambdas, like logging."""
class LambdaBase(object):
@classmethod
def get_handler(cls, *args, **kwargs):
def handler(event, context):
return cls(*args, **kwargs).handle(event, context)
return handler
@superposition
superposition / django-strorages.json
Created April 21, 2018 08:56 — forked from rockymeza/django-strorages.json
AWS IAM Policy for S3 for django-storages
{
   "Statement":[
      {
         "Effect":"Allow",
       
         "Action":[
            "s3:ListAllMyBuckets"
         ],
         "Resource":"arn:aws:s3:::*"
      },
@superposition
superposition / destructuring.js
Created May 1, 2018 22:39 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@superposition
superposition / install.sh
Created June 26, 2018 06:01 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@superposition
superposition / gist:cd97544345574879e0931398c169dfbf
Created June 27, 2018 18:01
Gist for installation of Docker
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@superposition
superposition / index.html
Created July 27, 2018 04:59
Kiosk Event Schedule — A Concept
<main>
<section v-for="(day, index) in schedule">
<header>
Day {{index+1}} &mdash; {{day.date | date}}
</header>
<ul>
<li v-for="slot in day.agenda" v-bind:class="{ current: checkTime(slot.range[0], slot.range[1]) }">
<h3><b>{{slot.display.h}}</b>{{slot.display.m}}{{slot.display.a}}</h3>
<div v-html="slot.desc"></div>
<div><small v-html="slot.location"></small></div>