Skip to content

Instantly share code, notes, and snippets.

@dalitun
dalitun / ec2_fetchkey
Created July 26, 2016 16:16 — forked from btm/ec2_fetchkey
FreeBSD + Openstack Notes
#!/bin/sh
# PROVIDE: ec2_fetchkey
# REQUIRE: NETWORKING
# BEFORE: LOGIN ec2_firstboot
# Define ec2_fetchkey_enable=YES in /etc/rc.conf and create /root/firstboot
# to enable SSH key fetching when the system next boots.
#
: ${ec2_fetchkey_enable=NO}
@dalitun
dalitun / install.sh
Created January 31, 2017 15:11 — 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"
@dalitun
dalitun / 01-02.py
Created February 6, 2017 00:21 — forked from dimi-tree/01-02.py
Udacity: Machine Learning for Trading
# Working with multiple stocks
"""
SPY is used for reference - it's the market
Normalize by the first day's price to plot on "equal footing"
"""
import os
import pandas as pd
import matplotlib.pyplot as plt
#!/bin/bash
# note: this script is invoked automatically by rackspace-flasky.py
# save command line arguments
GMAIL_USERNAME=$1
GMAIL_PASSWORD=$2
# install web server dependencies
apt-get update
apt-get -y install python python-virtualenv nginx supervisor git
@dalitun
dalitun / go.txt
Last active January 14, 2018 00:35
export GOROOT=$HOME/go
export PATH=$GOROOT/bin:$PATH
export GOPATH=$HOME/mygoproject1
export PATH=$GOPATH/bin:$PATH
===========
GO15VENDOREXPERIMENT=1 go run main.go
sudo apt-get update
sudo apt-get -y upgrade
@dalitun
dalitun / neutron-port-state-change.py
Created February 22, 2017 10:58 — forked from upa/neutron-port-state-change.py
Change port stauts via neutron api using neutron-python binding
#!/usr/bin/env python
import sys
import json
from neutronclient.v2_0 import client as neutronclient
authurl = 'http://10.0.2.15:5000/v2.0'
username = 'demo'
password = 'pass'
tenantname = 'demo'
#!/usr/bin/env bash
apt-get update && apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF > /etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update
# Install docker if you don't have it already.
apt-get install -y docker.io
@dalitun
dalitun / spec_helper.rb
Created March 9, 2017 11:21 — forked from pda/spec_helper.rb
Fast RSpec with a tiered environment: SPEC=(unit|model|full) rspec …
mode = ENV["SPEC"] || "full"
require_relative "spec_helper_#{mode}"
@dalitun
dalitun / Create-Jenkins-Master-On-Windows-Server-Core.ps1
Created March 10, 2017 14:08 — forked from PlagueHO/Create-Jenkins-Master-On-Windows-Server-Core.ps1
Create a Jenkins Master on a Windows Server 2012 R2 Core install
# Configure the settings to use to setup this Jenkins Executor
$Port = 80
$IPAddress = '192.168.1.96'
$SubnetPrefixLength = 24
$DNSServers = @('192.168.1.1')
$DefaultGateway = '192.168.1.1'
# Install .NET Framework 3.5
Install-WindowsFeature -Name NET-Framework-Core
@dalitun
dalitun / painless_q.py
Created March 29, 2017 13:11 — forked from kastnerkyle/painless_q.py
Painless Q-Learning Tutorial implementation in Python http://mnemstudio.org/path-finding-q-learning-tutorial.htm
# Author: Kyle Kastner
# License: BSD 3-Clause
# Implementing http://mnemstudio.org/path-finding-q-learning-tutorial.htm
# Q-learning formula from http://sarvagyavaish.github.io/FlappyBirdRL/
# Visualization based on code from Gael Varoquaux [email protected]
# http://scikit-learn.org/stable/auto_examples/applications/plot_stock_market.html
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection