Skip to content

Instantly share code, notes, and snippets.

View mikeatlas's full-sized avatar
💻

Mike Atlas mikeatlas

💻
View GitHub Profile
package main
import (
"fmt"
"time"
)
func main() {
t, err := time.Parse(time.RFC3339Nano, "2013-06-05T14:10:43.678Z")
if err != nil {
@mikeatlas
mikeatlas / circle.yml
Created May 31, 2013 23:15
Sample circle.yml - How to precompile assets of a rails project (using the turbo-sprockets-rails3 gem) before pushing to heroku
deployment:
continuous_integration_deployment_test:
branch: master
commands:
- git config --global user.email "ci@test.com"
- git config --global user.name "Continuous Integration"
- git checkout -b with_precompiled_assets
- bundle exec rake assets:precompile assets:clean_expired:
timeout: 1500
- git add public/assets
@mikeatlas
mikeatlas / push_to_heroku.rake
Last active December 18, 2015 03:09
Example of how to dynamically set a rails secret_token per-heroku app instance. This sets a heroku environment variable on deployment, which is attempted to be read as a secret_token key file. If the token is not found, a new one is generated on the fly (draw back here is that a dynamic secret_key is used every time the app restarts, causing all…
desc 'Pushes to heroku demo app'
task :push_to_demo => :environment do |t, args|
app_name = 'demo'
push app_name
end
def push(app_name)
puts "$$$$$$$$$$ Pushing to heroku app: #{app_name}"
puts "$$$$$ Pushing to heroku app: #{app_name}"
@mikeatlas
mikeatlas / .git-flow-branch-in-prompt.sh
Last active December 20, 2015 20:08
git flow branch in bash prompt (add to ~/.bash_profile)
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
@mikeatlas
mikeatlas / docker_centos
Created June 30, 2016 21:22 — forked from ravibhure/docker_centos
Docker for CentOS
# Disable selinux as it interferes with functionality of LXC
$ setenforce 0
$ echo 'SELINUX=disabled' > /etc/selinux/config
# Download and setup Fedora EPEL Repository
$ yum -y install http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
# Setup hop5.in repository
$ wget http://www.hop5.in/yum/el6/hop5.repo -O /etc/yum.repos.d/hop5.repo
@mikeatlas
mikeatlas / gist:0b69b354a8d713989147
Last active August 30, 2017 17:53
splitting polyline paths across the international dateline in leaflet (sorry that it uses a mix of jQuery and lo-dash for helpers and is in coffeescript)
Array.prototype.splitAtEvery = (callback) ->
sections = []
arrayClone = this.slice(0)
$.each(arrayClone, (idx, item) =>
sectionsLength = 0
_.each(sections, (section) =>
sectionsLength += section.length;
)
if callback(this, idx, item) == true
sections.push(arrayClone.slice(0, idx+1-sectionsLength))

HOWTO: Installing Vault On AWS Linux

This is quick howto for installing vault on AWS Linux, mostly to remind myself. At the end of this tutorial, you'll have a working vault server, using s3 for the backend, self signed certificates for tls, and supervisord to ensure that the vault server is always running, and starts on reboot.

Setting up S3

First things first, let's set up an s3 bucket to use as the storage backend for our s3 instance.

  1. From the AWS Mangement Console, go to the S3 console.

  2. Click on the Create Bucket button

@mikeatlas
mikeatlas / sync_ftp_to_s3.md
Last active January 12, 2018 15:54
syncing ftp to s3 one-time really fast.

Original idea from Transfer files from an FTP server to S3 by "Hack N Cheese".

I moved roughly a terrabyte in less than an hour. Granted, I couldn't take advantage of lftp's --parallel=30 switch due to my ftp source limiting me to one connection at a time, but use-pget-n=N did seem to help out.

  • Get a fast Ubuntu 14.4 EC2 box on Amazon for temporary usage (I went with m1.xlarge) so data tranfers aren't limited by your local bandwidth at least. I also attached a fat 2TB EBS volume and symlinked it to /bigdisk, and made sure the EBS volume was deleted after I terminated this EC2 box. I hope lftp 2.6.4 is available as a stable package by the next time I attempt this.
  • Build lftp 2.6.4+ (Not easy to compile, so read the INSTALL file and plow through all your missing dependencies - you'll also need to re-run `sudo ./configure && su
@mikeatlas
mikeatlas / gitflow-breakdown.md
Created February 27, 2018 20:40 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@mikeatlas
mikeatlas / settings.json
Last active May 7, 2018 15:23
my vscode user settings
{
"window.zoomLevel": -1,
"files.associations": {
"*.peg": "pegjs"
},
"gitlens.advanced.messages": {
"suppressCommitHasNoPreviousCommitWarning": false,
"suppressCommitNotFoundWarning": false,
"suppressFileNotUnderSourceControlWarning": false,
"suppressGitVersionWarning": false,