Skip to content

Instantly share code, notes, and snippets.

View tomzo's full-sized avatar

Tom Setkowski tomzo

View GitHub Profile
@tomzo
tomzo / gui-docker.md
Created September 18, 2019 08:14 — forked from rizky/gui-docker.md
Running Graphical applications in Docker for Mac

Setup

Docker for Mac lets you run any Linux executable in an isolated process on Mac. A graphical app is just another process, that needs access to the X11 socket of the system, or an X11 server. You can run X11 applications on a Mac using an open source project called Xquartz. The steps to expose XQuartz to a Linux process running in Docker are simple:

  1. install XQuartz from xquartz.org. Note: you need to install XQuartz version 2.7.10, version 2.7.11 does not work with Docker for Mac. Then you have 3 choices:
  2. Proxy the XQuartz socket to port 6000 or
  3. Tell Xquartz to accept network calls. This is not very secure.
  4. Tell Xquartz to accept network calls and require authentication, setup X11 security using xauth, and mount ~/.Xauthority in the container.
@tomzo
tomzo / on-boot.sh
Created May 26, 2019 14:49
Kill, disable and purge unattended upgrades in ubuntu
#!/bin/bash
# disable automatic upgrades to avoid error on start: "Could not get lock /var/lib/dpkg/lock"
cat << EOF > 20auto-upgrades
// Do "apt-get update" automatically every n-days (0=disable)
APT::Periodic::Update-Package-Lists "0";
// Run the "unattended-upgrade" security upgrade script
// every n-days (0=disabled)
// Requires the package "unattended-upgrades" and will write
// a log in /var/log/unattended-upgrades
APT::Periodic::Unattended-Upgrade "0";
@tomzo
tomzo / Dockerfile
Created December 3, 2018 14:19
GoCD build failing
FROM openjdk:8-jdk
MAINTAINER Tomasz Sętkowski <tom@ai-traders.com>
RUN apt-get update && apt-get install -y -q \
sudo fakeroot git nsis rpm unzip zip mercurial rake subversion wget
# install nodejs, update-alternatives is needed on ubuntu to enable command 'node'
RUN curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - &&\
apt-get install --yes nodejs && update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - &&\
@tomzo
tomzo / lstm_save_restore.py
Created December 27, 2017 11:39
Tensorflow LSTM cell save and restore with different batch size and unroll
import tensorflow as tf
import numpy as np
def print_ops():
graph = tf.get_default_graph()
ops = graph.get_operations()
print("Total ops:", len(ops))
for op in ops:
print(op.name, op.type)
@tomzo
tomzo / 3-5-lstm.py
Last active December 21, 2017 17:10 — forked from 3h4/3-5-lstm.py
from __future__ import print_function, division
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
num_epochs = 100
total_series_length = 50000
truncated_backprop_length = 15
state_size = 4
num_classes = 2
@tomzo
tomzo / build.sh
Created July 19, 2016 18:45
Compile terraform from sources in docker
#!/bin/bash
git clone https://github.com/hashicorp/terraform.git
docker run --rm -v "$PWD/terraform":/go/src/github.com/hashicorp/terraform -w /go/src/github.com/hashicorp/terraform golang:1.6 bash -c 'apt-get update && apt-get install -y zip && XC_OS=linux XC_ARCH=amd64 make bin'
#!/bin/dash
###
# ABOUT : collectd monitoring script for smartmontools (using smartctl)
# AUTHOR : Samuel B. <samuel_._behan_(at)_dob_._sk> (c) 2012
# LICENSE: GNU GPL v3
# SOURCE: http://devel.dob.sk/collectd-scripts/
#
# This script monitors SMART pre-fail attributes of disk drives using smartmon tools.
# Generates output suitable for Exec plugin of collectd.
###
@tomzo
tomzo / ceph-reweight-slowly
Last active October 21, 2015 13:12
Ceph reweight OSD slowly
#!/bin/bash
# Usage:
# ceph-reweight-slowly <OSD-ID> <IN or OUT>
#
# OUT will reweight osd from 1 to 0 in 0.1 decrements.
# E.g. when removing osd 1 from cluster: `ceph-reweight-slowly 1 out`
# IN will reweight osd from 0 to 1 in 0.1 increments.
# E.g. when adding osd 5 to cluster: `ceph-reweight-slowly 5 in`
#
@tomzo
tomzo / host-setup.sh
Created October 3, 2015 08:07
Running docker with X on host and GPU acceleration - PoC
#!/bin/bash
# Install host GPU drivers
# ...
# Start a bare X-server
X :0 &
# Make it possible to connect from other hosts
export DISPLAY=:0
xhost +
@tomzo
tomzo / ceph_rbd_restore.sh
Last active September 26, 2015 08:52
Script to restore ceph rbd volume
#!/bin/sh
#
# ORIGINAL AUTHORS
# Shawn Moore <smmoore@catawba.edu>
# Rodney Rymer <rrr@catawba.edu>
#
#
# REQUIREMENTS
# GNU Awk (gawk)
#