Skip to content

Instantly share code, notes, and snippets.

View bwv988's full-sized avatar
💭
🔥

Ralph Schlosser bwv988

💭
🔥
View GitHub Profile
# XML package demo.
# Create barplot of distribution of first letters
# in the Mondial database.
# RS15082015
library(XML)
library(ggplot2)
# Load data.
xml <- xmlTreeParse("~/Temp/mondial-3.0.xml", useInternalNodes = TRUE)
@bwv988
bwv988 / gist:f01b7553941ec5192b8f2dd9eeb24cc3
Last active January 3, 2017 11:48
Recursive git pull
find . -maxdepth 1 -type d -exec git --git-dir={}/.git --work-tree=$PWD/{} pull origin master \;
@bwv988
bwv988 / h2o_query.R
Created July 24, 2017 23:58
Question on treating "NA" values in H2O
# Question on treating "NA" values.
# RS25072017
# PROBLEM STATEMENT: Remove the "?" values in the data set, and turn them into "n". ---------------------
require(h2o)
# Modify below, as needed.
h2o.init(startH2O = FALSE)
@bwv988
bwv988 / h2o_sol.R
Created July 25, 2017 14:49
Data Manipulation in H20
# Data manipulation with H2O
# RS25072017
require(h2o)
h2o.init()
# 1. The R way. ---------------------
import pandas as pd
import numpy as np
# I want to clean col2. This records equipemnts.
data = {'col1': [1, 2, 4], 'col2': ["e70", "e70 e80 ua", "b20"]}
# Create a Pandas data frame.
df = pd.DataFrame(data)
# Quick helper function to flatten a nested list.
@bwv988
bwv988 / docker-cleanup-resources.md
Created February 1, 2018 15:10 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

startup_message off
vbell off
hardstatus alwayslastline
hardstatus string '%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?%+Lw%?%?%= %{g}]%{=y C}[%d/%m %c]%{W}'
# Generate word clouds from R.
# RS10062015
# May need to install the below packages.
#req <- c("wordcloud", "tm")
#install.packages(req)
library(tm)
library(wordcloud)
x y
1 1
2 4
3 9
4 16
@bwv988
bwv988 / docker-compose.yml
Created April 24, 2018 10:53
Docker compose file for the Kaggle Python container
version: '2'
services:
kaggle:
image: kaggle/python
container_name: kaggle
command: jupyter notebook --allow-root --no-browser --ip="0.0.0.0" --notebook-dir=/notebooks --NotebookApp.token='' --allow-root
user: root
ports:
- "8888:8888"
volumes: