Skip to content

Instantly share code, notes, and snippets.

View nicbet's full-sized avatar

Nicolas Bettenburg nicbet

View GitHub Profile
@nicbet
nicbet / Dockerfile
Created June 27, 2019 03:00
Elixir 1.9 Releases Alpine Linux Docker Multi-Stage Build
# ---- Build Stage ----
FROM erlang:22-alpine AS app_builder
# Set environment variables for building the application
ENV MIX_ENV=prod \
TEST=1 \
LANG=C.UTF-8
# Fetch the latest version of Elixir (once the 1.9 docker image is available you won't have to do this)
RUN set -xe \
@nicbet
nicbet / workbench.main.css
Created May 7, 2019 14:20
Visual Studio Code Tree Lines
/*!--------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
* /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.css
*--------------------------------------------------------*/
.monaco-action-bar{text-align:right;overflow:hidden;white-space:nowrap}.monaco-action-bar .actions-container{display:flex;margin:0 auto;padding:0;width:100%;justify-content:flex-end}.monaco-action-bar.vertical .actions-container{display:inline-block}.monaco-action-bar.reverse .actions-container{flex-direction:row-reverse}.monaco-action-bar .action-item{cursor:pointer;display:inline-block;transition:transform 50ms ease;position:relative}.monaco-action-bar .action-item.disabled{cursor:default}.monaco-action-bar.animated .action-item.active{transform:scale(1.272019649)}.monaco-action-bar .action-item .icon{display:inline-block}.monaco-action-bar .action-label{font-size:11px;margin-right:4px}.monaco-action-bar .action-label.octicon{fo
@nicbet
nicbet / song.txt
Created May 6, 2019 15:36
Teaching my Toddler about Bitbucket
The itsy bitsy bucket contains all our code,
down comes the git commit and adds another load,
out comes the pull request and merges the changes in,
the itsy bitsy bucket now has more code within.
@nicbet
nicbet / pretty_print.py
Created April 30, 2019 13:11
Prettier formatting of numbers for Tables in Python
def pretty_num(value, t=5):
if(len(repr(value)) > t):
if(value < 1):
return 0
else:
return '%.2e' % value
else:
return "{:,}".format(value)
@nicbet
nicbet / start_mysql.sh
Created April 9, 2019 16:23
Running Data Services via Docker with Persistent Data
#!/bin/bash
docker run --name mysql -d -e MYSQL_USER=mysql -e MYSQL_PASSWORD=mysql -e MYSQL_ROOT_PASSWORD=mysql -v $(pwd)/mysql:/var/lib/mysql -p 3306:3306 mysql:8
@nicbet
nicbet / .rubocop.yml
Created April 3, 2019 02:02
Rubocop sane defaults for Rails 5.2
Rails:
Enabled: true
AllCops:
TargetRubyVersion: 2.5
Exclude:
- bin/*
- Gemfile
- vendor/**/*
- node_modules/**/*
- db/schema.rb
@nicbet
nicbet / database.yml
Created April 3, 2019 01:56
DRY Database Config for Rails
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see Rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: <%= ENV.fetch("DB_USER") { "postgres" } %>
password: <%= ENV.fetch("DB_PASSWORD") { "postgres" } %>
host: <%= ENV.fetch("DB_HOST") { "localhost" } %>
@nicbet
nicbet / install-nvidia-docker.sh
Last active March 27, 2019 19:03
Install Nvidia-Docker on NVIDIA GPU Cloud Machine Ubuntu 18.04
#!/bin/bash
# Check for Hardware, GCC, Kernel
lspci | grep -i nvidia
gcc --version
uname -r
sudo apt-get install linux-headers-$(uname -r)
# Install Docker CE
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
@nicbet
nicbet / clean-docker-images.fish
Last active January 19, 2020 19:13
Delete all <none> Docker Images
alias clean_docker_images='for i in (docker image ls | grep none | tr -s " " | cut -d " " -f 3); docker image rm $i; end'
funcsave clean_docker_images
@nicbet
nicbet / kitty.conf
Created March 6, 2019 15:15
Kitty Terminal Configuration
# /.config/kitty/kitty.conf
# vim:fileencoding=utf-8:ft=conf:foldmethod=marker
#: Fonts {{{
#: kitty has very powerful font management. You can configure
#: individual font faces and even specify special fonts for particular
#: characters.