Skip to content

Instantly share code, notes, and snippets.

View AlexanderAllen's full-sized avatar
😸
Working from home @ Bushwick, NYC

AlexanderAllen AlexanderAllen

😸
Working from home @ Bushwick, NYC
View GitHub Profile
@AlexanderAllen
AlexanderAllen / bloatware_corporation.Dockerfile
Last active January 3, 2020 07:31
Or, how not to build Dockerfiles
FROM alexanderallen/php7-fpm.core:alpine-3.11 as core
ENV \
SSH_PRIVATE_KEY="/root/.ssh/id_rsa" \
LANG="en_US.UTF-8" \
LC_ALL="en_US.UTF-8" \
LANGUAGE="en_US.UTF-8" \
TERM="xterm" \
# Register the COMPOSER_HOME environment variable.
COMPOSER_HOME=/composer \
@AlexanderAllen
AlexanderAllen / .bashrc
Created January 3, 2020 00:06
Apply proper umask on WSL
# Note: Bash on Windows does not currently apply umask properly, fix it here.
if [[ "$(umask)" = "0000" ]]; then
umask 0022
fi
@AlexanderAllen
AlexanderAllen / wsl.conf
Created January 3, 2020 00:02
/etc/wsl.conf
# Save this into /etc/wsl.conf
# You will need sudo permissions setup in WSL.
# sudo vi /etc/wsl.conf
[automount]
enabled=true
# Mount root to /drive/ instead of /mnt/drive for docker compatibility.
root=/
# Unsets (unmasks) -wx bits for group/other so perms don't show up as 777 on WSL.
options="metadata,umask=22,fmask=11"
@AlexanderAllen
AlexanderAllen / install_docker_ubuntu_wsl.sh
Created January 2, 2020 23:57
Setting Ubuntu for WSL on Windows 10
# Update the apt package list.
sudo apt-get update -y
# Install Docker's package dependencies.
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
@AlexanderAllen
AlexanderAllen / localenv-drush.sh
Created January 1, 2020 22:42
Wake Up The Kraken : Fire up Drush Container
#!/bin/bash
# Using user-defined network eliminates need to use service links,
# and allows multiple compose stacks to join/leave network on a as-needed basis -
# as opposed to composing up or down an entire monolith compose stack.
#
# For benefits of user-defined bridge over default bridge https://docs.docker.com/network/bridge/
# Compose networking: https://docs.docker.com/compose/networking/
# Latest compose reference: https://docs.docker.com/compose/compose-file/#network-configuration-reference
@AlexanderAllen
AlexanderAllen / php7-cli.drush9:alpine-3.11.Dockerfile
Created January 1, 2020 21:40
Alpine Docker Image for DRUSH 9
#
# Build stage optimized with Composer packages for Drupal development.
#
FROM alexanderallen/php7-cli.core:alpine-3.11 as drush9
# Specifies which composer.json file to use for build.
ARG DRUSH_VERSION
RUN \
cd /tmp \
&& apk add --no-cache \
@AlexanderAllen
AlexanderAllen / php7-cli.core:alpine-3.11.Dockerfile
Last active January 1, 2020 21:39
Alpine Docker Image for Composer
FROM alexanderallen/php7-fpm.core:alpine-3.11 as core
ENV \
SSH_PRIVATE_KEY="/root/.ssh/id_rsa" \
LANG="en_US.UTF-8" \
LC_ALL="en_US.UTF-8" \
LANGUAGE="en_US.UTF-8" \
TERM="xterm" \
# Register the COMPOSER_HOME environment variable.
COMPOSER_HOME=/composer \
@AlexanderAllen
AlexanderAllen / cache.ts
Created December 11, 2019 02:03
levelup
/**
* @file: cache.ts
*/
// Import levelup dependencies manually.
var levelup = require('levelup')
var leveljs = require('level-js')
var ttl = require('level-ttl')
// Instantiate store.
var db = levelup(leveljs('/tmp/mydb.db'))
@AlexanderAllen
AlexanderAllen / 0_reuse_code.js
Created November 21, 2016 15:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@AlexanderAllen
AlexanderAllen / README.md
Created September 22, 2016 06:09 — forked from ralphschindler/README.md
Docker (For Mac) De-facto Host Address Alias (10.254.254.254) - "The 10254 Trick".

Docker (Mac) De-facto Standard Host Address Alias

This launchd script will ensure that your Docker environment on your Mac will have 10.254.254.254 as an alias on your loopback device (127.0.0.1). The command being run is ifconfig lo0 alias 10.254.254.254

Installation

Copy/Paste the following in terminal with sudo (must be root as the target directory is owned by root)...

sudo curl -o /Library/LaunchDaemons/com.ralphschindler.docker_10254_alias.plist https://gist.githubusercontent.com/ralphschindler/535dc5916ccbd06f53c1b0ee5a868c93/raw/com.ralphschindler.docker_10254_alias.plist