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 / rbtree.go
Last active May 11, 2020 03:54
Red-black tree implementation in Go
package rbtree
type Node struct {
Color string
Key int
Value int
Left, Right *Node
P *Node
}
#!/usr/bin/env bash
cd /tmp
apt-get update
export ANACONDA_LOCATION="anaconda3"
export ANACONDA_FILE="Anaconda3-5.3.1-Linux-x86_64.sh"
export ANACONDA_URL="https://repo.anaconda.com/archive/"
export ANACONDA_HOME=/usr/$ANACONDA_LOCATION
@pacuna
pacuna / script.sh
Last active February 27, 2019 04:35
script
set -x
echo 'export PATH="/opt/conda/bin:$PATH"' >> ~/.bashrc
sudo apt-get update --fix-missing && sudo apt-get install -y wget bzip2 ca-certificates \
libglib2.0-0 libxext6 libsm6 libxrender1 git
wget --quiet https://repo.anaconda.com/archive/Anaconda3-2018.12-Linux-x86_64.sh -O ~/anaconda.sh && \
sudo /bin/bash ~/anaconda.sh -b -p /opt/conda && \
rm ~/anaconda.sh && \
sudo ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
version: '3'
volumes:
postgres_data:
driver: local
services:
postgres:
image: postgres
volumes:
{
"title": "Use CAPS LOCK for pok3r navigation",
"rules": [{
"description": "CAPS LOCK + ijkl to arrow keys",
"manipulators": [{
"type": "basic",
"from": {
"key_code": "k",
"modifiers": {
"optional": [
@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']])
function execpod(){
kubectl exec -it $(kubectl get pods | grep -m1 $1 | grep -o '^\s*\S\+') /bin/bash
}

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

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
@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 ~