Skip to content

Instantly share code, notes, and snippets.

👾
Happy!

Duane DuaneNielsen

👾
Happy!
Block or report user

Report or block DuaneNielsen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@DuaneNielsen
DuaneNielsen / fixup.py
Created Jun 25, 2019
Implementation of Resnet trained with Fixup. No BatchNorm! https://arxiv.org/abs/1901.09321
View fixup.py
import torch
import torch.nn as nn
from torchvision.datasets import CIFAR10
from torch.utils.data import DataLoader, random_split, Dataset, ConcatDataset
from tqdm import tqdm
from torch.optim import Adam, SGD
from torchvision.transforms import *
import statistics as stats
from pathlib import Path
from torch.nn.functional import avg_pool2d
@DuaneNielsen
DuaneNielsen / install
Last active Apr 29, 2019
Install small redis distrib
View install
snap install helm --classic
/snap/bin/helm init
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
wget https://raw.githubusercontent.com/kubernetes/charts/master/stable/redis/values.yaml
vi values.yaml
#change usePassword: false
helm install stable/redis -n ppo-redis --values values.yaml
@DuaneNielsen
DuaneNielsen / notes
Created Apr 27, 2019
Install kubenetes using kubeadmin
View notes
install docker ce https://docs.docker.com/install/linux/docker-ce/ubuntu/
setup docker cri https://kubernetes.io/docs/setup/cri/
# Setup daemon.
cat > /etc/docker/daemon.json <<EOF
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
View PASTE INTO CMD PROMPT
wget -O - https://gist.githubusercontent.com/DuaneNielsen/3f021803cabd3bf70d013f566c450b96/raw/fbeeea40aa0be56098ea34cce9357292a603f15e/install_docker.sh | bash
wget -O - https://gist.githubusercontent.com/DuaneNielsen/3f021803cabd3bf70d013f566c450b96/raw/0c6915f2ceea8fa953f7c5de9825e1b2c627aa5c/config_linux.sh | bash
@DuaneNielsen
DuaneNielsen / docker.sh
Last active Apr 26, 2019
running Docker containers inside LXC containers
View docker.sh
lxc launch ubuntu:bionic test
lxc exec test /bin/bash --
<install docker ce>
lxc stop test
lxc profile edit docker
lxc profile assign test docker
mount -o bind /var/lib/kubelet /var/lib/kubelet
mount --make shared /var/lib/kubelet
@DuaneNielsen
DuaneNielsen / install.sh
Last active Apr 17, 2019
setup microk8s
View install.sh
snap install --channel 1.13/stable --classic microk8s
microk8s.enable registry
microk8s.enable dns
microk8s.enable storage # not sure if i need this
#install
snap install helm --classic
/snap/bin/helm init
helm install stable/redis -n ppo-redis
snap alias microk8s.kubectl kubectl
View Configing microk8s with helm
c@ccube:~$ sudo snap install helm
helm 2.9.1 from 'snapcrafters' installed
c@ccube:~$ /snap/bin/helm init
Please copy Kubernetes config to /home/c/snap/helm/common/kube/config.
c@ccube:~$ cp /snap/microk8s/current/client.config /home/c/snap/helm/common/kube/config
c@ccube:~$ /snap/bin/helm init
Creating /home/c/snap/helm/common/repository
Creating /home/c/snap/helm/common/repository/cache
Creating /home/c/snap/helm/common/repository/local
Creating /home/c/snap/helm/common/plugins
View Putting Docker image into microk8s
# use 1.13 stable, it still supports docker well
snap install --channel 1.13/stable --classic microk8s
microk8s.docker build Dockerfile
microk8s.docker tag <container from last step> 127.0.0.1:32000/<name you want for container>
mickrok8s.docker push 127.0.0.1:32000/<name you want for container>
container will now be available as 127.0.0.1:32000/<name you want for container>
View Reconfiguring kubelet on microk8s
snap info microk8s
snap run --shell microk8s.start
echo $SNAP_DATA
cd $SNAP_DATA
cd args
vi kublet
@DuaneNielsen
DuaneNielsen / Postgress setup for python
Last active Apr 4, 2019
Links for getting postgres up and running on python and ubuntu
View Postgress setup for python
https://www.fullstackpython.com/blog/postgresql-python-3-psycopg2-ubuntu-1604.html
https://stackoverflow.com/questions/18664074/getting-error-peer-authentication-failed-for-user-postgres-when-trying-to-ge
http://initd.org/psycopg/docs/install.html
http://docs.peewee-orm.com/en/latest/peewee/quickstart.html#quickstart
https://blog.bigbinary.com/2016/01/23/configure-postgresql-to-allow-remote-connection.html
You can’t perform that action at this time.