On Instance:
pip install jupyter[notebook]
jupyter notebook --generate-config
# nano .jupyter/jupyter_notebook_config.py
echo "c = get_config()
c.NotebookApp.ip = '*'
""" | |
Plot white noise with added sinusoidal signal | |
""" | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import sys | |
import h5py | |
fs = 4096 # sampling rate [Hz] | |
T = 4 # duration [s] |
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
import warnings | |
import numpy as np | |
import pandas as pd | |
import sys | |
__author__ = "Mohsen Mesgarpour" | |
__copyright__ = "Copyright 2016, https://github.com/mesgarpour" | |
__credits__ = ["Mohsen Mesgarpour"] |
#-*- coding: utf-8 -*- | |
""" | |
GIBBS SAMPLING IMPLEMENTATION FOR LATENT DIRICHLET ALLOCATION (2003) | |
IMPLEMENTED BY CHANG-UK, PARK | |
DATA FORMAT: "DocID\t WordID\t FREQUENCY\n" | |
""" | |
import sys | |
import random |
On Instance:
pip install jupyter[notebook]
jupyter notebook --generate-config
# nano .jupyter/jupyter_notebook_config.py
echo "c = get_config()
c.NotebookApp.ip = '*'
# This script is designed to work with ubuntu 16.04 LTS | |
# with keras 1.2.2 and the latest Pytorch with CUDA 8 support | |
########################################################################## | |
#This is used to install CUDA 8 driver for Tesla K80 | |
########################################################################## | |
#!/bin/bash | |
echo "Checking for CUDA and installing." | |
# Check for CUDA and try to install. | |
if ! dpkg-query -W cuda-8-0; then |
from random import choice | |
from scrapy import signals | |
from scrapy.exceptions import NotConfigured | |
class RotateUserAgentMiddleware(object): | |
"""Rotate user-agent for each request.""" | |
def __init__(self, user_agents): | |
self.enabled = False | |
self.user_agents = user_agents |
// LRUCache.js - super simple JavaScript Implementation | |
// LRU stands for "Least Recently Used" | |
// https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU | |
// ----------------------------------------- | |
function LRUNode(key) { | |
this.key = key; | |
this.next = this.prev = null; | |
} |
import { graphql } from 'react-apollo'; | |
import { connect } from 'react-redux'; | |
import { compose } from 'redux'; | |
import { | |
change, | |
getFormSubmitErrors, | |
getFormValues, | |
reduxForm, | |
stopAsyncValidation, |
object MindBlown extends App { | |
trait Monoid[A] { | |
def op(a1: A, a2: A): A | |
def zero: A | |
} | |
val intAddition = new Monoid[Int] { | |
override def op(a1: Int, a2: Int) = a1 + a2 | |
override def zero = 0 | |
} |
pg_dump -h <rds host> -p 5432 -F c -O -U <rds user> <db name> > db.dump
docker run --rm --interactive --link <postgres container id>:postgres --volume $PWD/:/tmp/ postgres:latest /bin/bash -c 'pg_restore --verbose --clean --no-acl --no-owner -h "$POSTGRES_PORT_5432_TCP_ADDR" -p "$POSTGRES_PORT_5432_TCP_PORT" -U postgres -d <db name> /tmp/db.dump'