Skip to content

Instantly share code, notes, and snippets.

View pacuna's full-sized avatar

Pablo Acuña pacuna

  • Spotify
  • Austin, TX
View GitHub Profile
@pacuna
pacuna / composer.json
Created December 19, 2013 06:45
composer.json file for running Laravel 4 on dokku
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.1.*",
"way/generators": "dev-master",
"cartalyst/sentry": "2.0.*",
"jasonlewis/basset": "dev-master",
describe 'POST #create' do
it "saves the post to the db" do
expect{
post :create, :post => {:title => "The title", :body => "The Body"}
}.to change(Post, :count).by(1)
end
it "redirects to @post" do
@post = {:title => 'The title', :body => 'The body'}
post :create, :post => @post
@pacuna
pacuna / gist:801d594051967542139a6f3b9a4fd7e2
Created February 28, 2017 17:47
Install Vim 8 with Python, Python 3, Ruby and Lua support on Ubuntu 16.04
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-gui-common
sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev python3-dev ruby-dev libperl-dev libncurses5-dev libatk1.0-dev libx11-dev libxpm-dev libxt-dev
#Optional: so vim can be uninstalled again via `dpkg -r vim`
sudo apt-get install checkinstall
sudo rm -rf /usr/local/share/vim /usr/bin/vim
cd ~
DOCKER_REGISTRY_SERVER=https://index.docker.io/v1/
DOCKER_USER=Type your dockerhub username, same as when you `docker login`
DOCKER_EMAIL=Type your dockerhub email, same as when you `docker login`
DOCKER_PASSWORD=Type your dockerhub pw, same as when you `docker login`
kubectl create secret docker-registry myregistrykey \
--docker-server=$DOCKER_REGISTRY_SERVER \
--docker-username=$DOCKER_USER \
--docker-password=$DOCKER_PASSWORD \
--docker-email=$DOCKER_EMAIL

I have been an aggressive Kubernetes evangelist over the last few years. It has been the hammer with which I have approached almost all my deployments, and the one tool I have mentioned (shoved down clients throats) in almost all my foremost communications with clients, and it was my go to choice when I was mocking my first startup (saharacluster.com).

A few weeks ago Docker 1.13 was released and I was tasked with replicating a client's Kubernetes deployment on Swarm, more specifically testing running compose on Swarm.

And it was a dream!

All our apps were already dockerised and all I had to do was make a few modificatons to an existing compose file that I had used for testing before prior said deployment on Kubernetes.

And, with the ease with which I was able to expose our endpoints, manage volumes, handle networking, deploy and tear down the setup. I in all honesty see no reason to not use Swarm. No mission-critical feature, or incredibly convenient really nice to have feature in Kubernetes that I'm go

function execpod(){
kubectl exec -it $(kubectl get pods | grep -m1 $1 | grep -o '^\s*\S\+') /bin/bash
}
@pacuna
pacuna / mbox-to-csv.py
Created April 2, 2018 17:58 — forked from davidpelayo/mbox-to-csv.py
Simple mbox parser to csv in Python
import mailbox
import csv
writer = csv.writer(open("mbox-output.csv", "wb"))
for message in mailbox.mbox('file.mbox/mbox'):
writer.writerow([message['message-id'], message['subject'], message['from']])
{
"title": "Use CAPS LOCK for pok3r navigation",
"rules": [{
"description": "CAPS LOCK + ijkl to arrow keys",
"manipulators": [{
"type": "basic",
"from": {
"key_code": "k",
"modifiers": {
"optional": [
version: '3'
volumes:
postgres_data:
driver: local
services:
postgres:
image: postgres
volumes: