Skip to content

Instantly share code, notes, and snippets.


Antonio Alberto Lobato tomlobato

View GitHub Profile
troyharvey / deployment.yml
Last active Nov 16, 2022
Using Kubernetes envFrom for environment variables
View deployment.yml
# Use envFrom to load Secrets and ConfigMaps into environment variables
apiVersion: apps/v1beta2
kind: Deployment
name: mans-not-hot
app: mans-not-hot
replicas: 1
kolosek /
Last active Oct 21, 2017
Latest rails installation script for Ubuntu 16.04
echo "Updates packages. Asks for your password."
sudo apt-get update -y
echo "Installs packages. Give your password when asked."
sudo apt-get install -y curl nodejs libcurl4-gnutls-dev git-core libxslt1-dev libxml2-dev libsqlite3-dev libgmp-dev libmysqlclient-dev git git-doc libncurses5-dev build-essential rake libqt4-dev libqtwebkit-dev openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config libv8-dev libmagickwand-dev libreadline-dev libedit-dev libgdbm-dev libffi-dev zlib1g-dev rake curl vim libgmp3-dev phantomjs imagemagick
echo "Setting up mysql"
sudo apt-get install -y mysql-server mysql-client
echo "Setting up postgres"
niflostancu /
Created Jan 4, 2017
Installing Ubuntu 16.04 on btrfs using debootstrap

Installing Ubuntu 16.04 with btrfs using debootstrap

Partition layout

First, create a GPT partition table.

  1. boot partition, label: EFI, flags: boot + ESP; size: 1GB, format to FAT32;
  2. root partition (label: root), must same size on all devices!
  3. swap partition.
niieani /
Last active Oct 28, 2022
throttle and debounce commands in bash
#!/usr/bin/env bash
declare -i last_called=0
declare -i throttle_by=2
@throttle() {
local -i now=$(date +%s)
if (($now - $last_called >= $throttle_by))
CMCDragonkai /
Last active Nov 22, 2022
Linux: Understanding the Memory Layout of Linux Executables

Understanding the Memory Layout of Linux Executables

Required tools for playing around with memory:

  • hexdump
  • objdump
  • readelf
  • xxd
  • gcore
miharekar / struct_vs_class.rb
Created Mar 6, 2015
Ruby: Struct vs Class performance
View struct_vs_class.rb
require 'benchmark/ips'
Benchmark.ips do |x|
SingleFilterStruct =, :values) do
def call(value)
Array(value).any? { |v| v.send(method, *values) }
class SingleFilterClass
anarchivist /
Last active May 3, 2022
Slack notification script for Munin
# Slack notification script for Munin
# Mark Matienzo (@anarchivist)
# To use:
# 1) Create a new incoming webhook for Slack
# 2) Edit the configuration variables that start with "SLACK_" below
# 3) Add the following to your munin configuration:
everbeen / benchmark.go
Last active Apr 13, 2022
BSON vs. Gob vs. MessagePack encoding & decoding benchmark
View benchmark.go
package main
import (
nevans / gist:9374041
Last active Oct 7, 2019
simple ruby console histogram generator
View gist:9374041
# Pass in an enumeration of data and
# (optionally) a block to extract the grouping aspect of the data.
# Optional: sort_by lambda (operates on group key and count)
def puts_hist(data, sort_by:nil, &blk)
data = if blk
counts = data.each_with_object( {|k,h| h[k]+=1}
max = counts.values.max
width = Pry::Terminal.size!.last
havenwood / benchmark_results.rb
Last active May 26, 2021
Benchmarking serialization speed of YAML, JSON, Marshal, and MessagePack in Ruby, JRuby, and Rubinius
View benchmark_results.rb
# ruby-2.5.0
user system total real
YAML 15.112795 0.030577 15.143372 ( 15.190573)
JSON 0.648957 0.001520 0.650477 ( 0.652856)
Marshal 0.474775 0.000922 0.475697 ( 0.477678)
MessagePack 0.326430 0.001763 0.328193 ( 0.330159)
# ruby-2.4.3
user system total real
YAML 20.400000 0.050000 20.450000 ( 20.517600)