jq is useful to slice, filter, map and transform structured json data.
brew install jq
# open the current folder in Finder's tab | |
function oft() { | |
local folder_name=$1 | |
if ! [[ -d $1 ]]; then | |
# it is a file, get the enclosing folder | |
folder_name="$(dirname "$1")" | |
fi | |
# if no arguments are given, we use the current folder |
sudo apt-get install libgeos-3.X.X | |
sudo apt-get install libgeos-dev | |
pip install --user https://github.com/matplotlib/basemap/archive/master.zip |
{-# LANGUAGE OverloadedStrings #-} | |
import Data.Aeson | |
import Control.Applicative ((<$>), (<*>)) | |
import Control.Monad (mzero) | |
import Network.HTTP.Conduit | |
import Data.ByteString.Lazy.Internal (ByteString(..)) | |
data Item = Item { title :: String | |
, url :: String |
# imports | |
import numpy as np | |
import cv2 | |
import matplotlib.pyplot as plt | |
# The Hough Transform is a popular algorithm for detecting any shape that can | |
# be represented in a parametric mathmatical form in binary images. This | |
# usually means that images need to be thresholded or filtered prior to running |
Ansible playbook to setup HTTPS using Let's encrypt on nginx. | |
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS. | |
The server pass A rating on [SSL Labs](https://www.ssllabs.com/). | |
To use: | |
1. Install [Ansible](https://www.ansible.com/) | |
2. Setup an Ubuntu 16.04 server accessible over ssh | |
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain | |
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder) |
'''This script goes along the blog post | |
"Building powerful image classification models using very little data" | |
from blog.keras.io. | |
It uses data that can be downloaded at: | |
https://www.kaggle.com/c/dogs-vs-cats/data | |
In our setup, we: | |
- created a data/ folder | |
- created train/ and validation/ subfolders inside data/ | |
- created cats/ and dogs/ subfolders inside train/ and validation/ | |
- put the cat pictures index 0-999 in data/train/cats |
'''This script goes along the blog post | |
"Building powerful image classification models using very little data" | |
from blog.keras.io. | |
It uses data that can be downloaded at: | |
https://www.kaggle.com/c/dogs-vs-cats/data | |
In our setup, we: | |
- created a data/ folder | |
- created train/ and validation/ subfolders inside data/ | |
- created cats/ and dogs/ subfolders inside train/ and validation/ | |
- put the cat pictures index 0-999 in data/train/cats |
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """ | |
import numpy as np | |
import cPickle as pickle | |
import gym | |
# hyperparameters | |
H = 200 # number of hidden layer neurons | |
batch_size = 10 # every how many episodes to do a param update? | |
learning_rate = 1e-4 | |
gamma = 0.99 # discount factor for reward |
# import the gym stuff | |
import gym | |
# import other stuff | |
import random | |
import numpy as np | |
# import own classes | |
from deepq import DeepQ | |
env = gym.make('CartPole-v0') |