Skip to content

Instantly share code, notes, and snippets.

Modifying an Existing Docker Image

To install a custom package or modify an existing docker image we need to

  1. run a docker a container from the image we wish to modify
  2. modify the docker container
  3. commit the changes to the container as a docker image
  4. test changes made to image

1.) Running a docker container from an image

library(plyr)
find_zones <- function(x) {
x.mean <- mean(x)
x.sd <- sd(x)
boundaries <- seq(-4, 4)
# creates a set of zones for each point in x
zones <- sapply(boundaries, function(i) {
i * rep(x.sd, length(x))
})
const [widgets, setWidgets] = React.useState<Widget[]>([]);
const [animals, setAnimals] = React.useState<Animal[]>([]);
useSyncToTable<Widget[]>({
thingToWatch: widgets,
tableName: "widgets",
debounce: 500,
});
# function takes the following parameters:
# - func: the function you want to call with a timeout
# - ...: any arguments that should be passed to your function
# - seconds: duration until timeout
# - default: default value to return if timeout occurs
timeout.wrapper <- function(func, ..., seconds=3, default=NULL) {
tryCatch({
setTimeLimit(elapsed=seconds, transient=TRUE)
func(...)
}, error = function(e) {
#---from your local---#
ssh -i yhat.pem ubuntu@your-ec2-ip-address
#---on the server---#
# let's add a user
sudo adduser greg
# update
sudo apt-get update
library(XML)
library(uuid)
library(stringr)
library(plyr)
library(reshape2)
library(ggplot2)
f <- "https://raw.githubusercontent.com/chris-taylor/USElection/master/data/electoral-college-votes.csv"
electoral.college <- read.csv(f, header=FALSE)
names(electoral.college) <- c("state", "electoral_votes")
@glamp
glamp / svmflag.py
Last active March 5, 2021 06:59
Plotting SVM predictions using matplotlib and sklearn
import numpy as np
import pylab as pl
import pandas as pd
from sklearn import svm
from sklearn import linear_model
from sklearn import tree
from sklearn.metrics import confusion_matrix
{
"location": {
"name": "Nederland",
"region": "Colorado",
"country": "United States of America",
"lat": 39.96,
"lon": -105.5,
"tz_id": "America/Denver",
"localtime_epoch": 1608142276,
"localtime": "2020-12-16 11:11"
import pandas as pd
from ggplot import *
from sklearn.datasets import fetch_20newsgroups
from sklearn.metrics import roc_curve
# vectorizer
from sklearn.feature_extraction.text import HashingVectorizer
# our classifiers
from sklearn.naive_bayes import BernoulliNB, MultinomialNB
@glamp
glamp / clubhouse.md
Last active November 22, 2020 17:01
Bug Reporting Templates

Environment

URL: Stage: <dev/staging/qa/prod> (if applicable)

Logs