Skip to content

Instantly share code, notes, and snippets.

@elijahc
elijahc / keras_reset_weights.py
Created April 13, 2018 18:27
Reset weights in a Keras layer
import keras.backend as K
def reset_weights(model):
session = K.get_session()
for layer in model.layers:
if hasattr(layer, 'kernel_initializer'):
layer.kernel.initializer.run(session=session)
@elijahc
elijahc / loadaerdat.py
Last active April 7, 2018 19:03
Example script for loading aerdat files from neuromorphic DVS camera
# Source:
# https://sourceforge.net/p/jaer/code/HEAD/tree/scripts/python/jAER_utils/loadaerdat.py
import struct
import os
V3 = "aedat3"
V2 = "aedat" # current 32bit file format
V1 = "dat" # old format
EVT_DVS = 0 # DVS event type
@elijahc
elijahc / autonrn.sh
Created February 6, 2018 01:02
Script for installing NEURON and python 2.7 on ec2
# Install the relevant system requirements
sudo apt-get update
# Install Python 2.7 w/ development headers
sudo apt-get install -y python
sudo apt-get install -y python-dev
# Install NEURON deps
sudo apt-get install -y libx11-dev
sudo apt-get install -y libxext-dev
@elijahc
elijahc / jupyter-hub-setup.md
Created November 8, 2017 02:56
Setting up Jupyterhub with multiple virtualenv kernels managed with pyenv
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@elijahc
elijahc / hw1.ipynb
Last active September 19, 2017 17:09
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@elijahc
elijahc / _readme.md
Created August 19, 2017 17:28
Adding new environments to jupyter when using pyenv

apt hostadp does not support edimax ew-7811un

This build allows support for it

$ mkdir ~/src
$ cd ~/src
$ wget https://github.com/jenssegers/RTL8188-hostapd/archive/v1.1.tar.gz
$ tar -zxvf v1.1.tar.gz
$ cd RTL8188-hostapd-1.1/hostapd
@elijahc
elijahc / _readme.md
Last active May 30, 2023 05:34
Setup Raspberry Pi 2/3 to host control website over wifi

Install hostapd and lighttpd (high performance hosting)

$ sudo apt-get install hostapd lighttpd

Edit interfaces to load your wlan interface on boot

# Add the following (and consider making a backup of interfaces):
allow-hotplug wlan1
@elijahc
elijahc / kali_pi_over_eth.md
Last active August 12, 2017 10:12
Kali Raspberry Pi Setup over Ethernet

Hardcode IP address into the boot sequence on the SD card (cmdline.txt)

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 elevator=deadline root=/dev/mmcblk0p2 rootfstype=ext4 rootwait ip=169.254.113.200

Try pinging the raspi

$ ping 169.254.113.200