Skip to content

Instantly share code, notes, and snippets.

View bradbergeron-us's full-sized avatar

Brad Bergeron bradbergeron-us

View GitHub Profile
@bradbergeron-us
bradbergeron-us / gulpfile.js
Created June 11, 2015 14:28
Gulp File for Jekyll Blog
// Generated on <%= (new Date).toISOString().split("T")[0] %> using <%= pkg.name %> <%= pkg.version %>
"use strict";
var gulp = require("gulp");
// Loads the plugins without having to list all of them, but you need
// to call them as $.pluginname
var $ = require("gulp-load-plugins")();
// "del" is used to clean out directories and such
var del = require("del");
<% if (amazonCloudfrontS3) { %>// Parallelize the uploads when uploading to Amazon S3
@bradbergeron-us
bradbergeron-us / NPM N0 more Sudo
Created June 8, 2015 09:38
NPM no more 'sudo'
Copy and paste following commands into terminal
-----------------------------
brew install node --without-npm
mkdir "${HOME}/.npm-packages"
echo NPM_PACKAGES="${HOME}/.npm-packages" >> ${HOME}/.bashrc
echo NPM_PACKAGES="${HOME}/.npm-packages" >> ${HOME}/.zshrc
echo prefix=${HOME}/.npm-packages >> ${HOME}/.npmrc
curl -L https://www.npmjs.org/install.sh | sh
echo NODE_PATH=\"\$NPM_PACKAGES/lib/node_modules:\$NODE_PATH\" >> ${HOME}/.bashrc
@bradbergeron-us
bradbergeron-us / Rakefile
Created June 2, 2015 04:49
Rakefile for Symlinking dotfiles
desc "Symlink every file"
task :default do
files = Dir.glob("*").reject { |file| file == "Rakefile" }
current_path = File.dirname(__FILE__) + "/"
# Print start message
p "Symlinking: #{files.join(", ")}"
files.each do |file|
sh "ln -vfs #{current_path}#{file} ~/.#{file}"
# backtick is a kernel operation in Ruby
# which mean it can be overridden
# backtick method is called on the implicit receiver (that is, “self”). That means that you # can do this:
'''
#! bin/env ruby
require 'net/http'
@bradbergeron-us
bradbergeron-us / Docker_Deploy.md
Last active October 3, 2021 18:18
Deploying a Docker Registry

Deploying a registry server

This section explains how to deploy a Docker Registry either privately for your own company or publicly for other users. For example, your company may require a private registry to support your continuous integration (CI) system as it builds new releases or test servers. Alternatively, your company may have a large number of products or services with images you wish to serve in a branded manner.

Docker's public registry maintains a default registry image to assist you in the deployment process. This registry image is sufficient for running local tests but is insufficient for production. For production you should configure and build your own custom registry image from the docker/distribution code.

Note: The examples on this page were written and tested using Ubuntu 14.04. If you are running Docker in a different OS, you may need to "translate" the commands to meet the requirements of your own environment.

###Simple example with the official image In this section, you cre

@bradbergeron-us
bradbergeron-us / Docker_JekyllTemp
Created May 28, 2015 06:23
Template File for Configuring Dockerfile with Jekyll Site
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get install -y git curl nano build-essential libssl-dev libreadline-dev libffi-dev libgdbm-dev
# install ruby
ADD http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.bz2 /
RUN tar xvjf ruby-2.1.2.tar.bz2 && cd ruby-2.1.2 && ./configure --disable-install-doc --with-openssl-dir=/usr/bin && make && make install && cd / && rm -rf /ruby-2.1.2
RUN gem install sass compass jekyll --no-ri --no-rdoc
@bradbergeron-us
bradbergeron-us / Pg_DataDump
Last active August 29, 2015 14:22
Use for importing a database -> Add to init shell script then drop into ***/docker-entrypoint-initdb.d *** Start Postgres import via "pg_restore" then "stop database"
#!/bin/bash
: ${DB_USER:=db_user}
: ${DB_PASSWORD:=db_pass}
: ${DB_NAME:=db_name}
: ${DB_ENCODING:=UTF-8}
: ${DB_PG_DUMP_FILE:=/tmp/db.pgdump}
{ gosu postgres postgres --single -jE <<-EOSQL
CREATE USER "$DB_USER" WITH PASSWORD '$DB_PASSWORD';
@bradbergeron-us
bradbergeron-us / clearfix
Created April 27, 2015 14:02
CSS Clearfiix
.clearfix:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
.clearfix { display: inline-block; }
html[xmlns] .clearfix { display: block; }
* html .clearfix { height: 1%; }
@bradbergeron-us
bradbergeron-us / gist:c77b81abc94f6db67ebb
Created April 24, 2015 14:45
NPM and Node with no Sudo
# take ownership of the folders that npm/node use
# please don't do this if you don't know what it does!
sudo mkdir -p /usr/local/{share/man,bin,lib/node,include/node}
sudo chown -R $USER /usr/local/{share/man,bin,lib/node,include/node}
# now just a pretty vanilla node install
# let it use the default paths, but don't use sudo, since there's no need
mkdir node-install
curl http://nodejs.org/dist/node-v0.4.3.tar.gz | tar -xzf - -C node-install
cd node-install/*
@bradbergeron-us
bradbergeron-us / Brew_Shipment_OSX.rb
Last active August 29, 2015 14:19
Adds All The Homebrew Packages that I always Forget about in a single Script
#!/usr/bin/env ruby
def parse_package_list(string)
lines = string.split("\n")
active_packages = lines.reject{|package| package =~ /\A\s*\#/}
active_packages.each { |package| package.sub!(/\s*\#.*\Z/, '') }
active_packages
end
brew_packages = parse_package_list(<<-EOD)