Skip to content

Instantly share code, notes, and snippets.

agarie / create-posts-from-csv.rb
Created Dec 10, 2021
This script receives (from a filename argument or stdin) a CSV, with headers, containing columns post_title, post_date and post_content and converts each entry into a markdown post with Liquid front matter.
View create-posts-from-csv.rb
#!/usr/bin/env ruby
# Convert the entries from a CSV with headers
# - post_title
# - post_date (must include year-month-day)
# - post_content
# into markdown posts with Liquid's front matter and the correct naming
# structure. Reminder that valid HTML posts are also valid markdown.
require "csv"
agarie / parse_wp_exported_posts_backup.rb
Created Dec 6, 2021
A script to convert the posts from a WordPress SQL backup into a CSV for easier handling with other tools. Important comment: "Typical reminder to not write a parser half drunk at 3AM".
View parse_wp_exported_posts_backup.rb
# Parse a SQL file exported from a WordPress site containing the posts backup,
# generally named `wphf_posts.sql`, and create a file `wphf_posts.sql.csv`
# containing the data in CSV format.
# I could've used a proper sql parser but was in the mood to write some shitty code lol
require 'csv'
agarie / download-conf-papers.rb
Last active Dec 12, 2017
Quick script I made to download papers from NIPS. The subjects are specified in `SUBJECTS_RE`.
View download-conf-papers.rb
require 'fileutils'
require 'nokogiri'
require 'open-uri'
require 'pp'
require 'typhoeus'
SUBJECTS_RE = /deep|deeply|neural|convolutional|network|recurrent|lstm|object recognition|object classification|object detection|image classification/
def paper_list_url(issue)
"{issue}-#{1987 + issue}"
agarie /
Created Jan 20, 2017
Convert the colors of a PDF file from RGB to CMYK for printing.
gs -dSAFER -dBATCH \
-sColorConversionStrategy=CMYK \
-dProcessColorModel=/DeviceCMYK \
-sOutputFile=$2 \
agarie / faces_dataset_32x30.list
Last active Nov 19, 2015
Code used to convert the PGM images from the dataset used in one of Tom Mitchell's homework assignments ( to CSV files.
View faces_dataset_32x30.list
agarie /
Last active Feb 27, 2021
tmux cheatsheet
agarie / A evolução de uma arquitetura distribuí
Created Jul 2, 2015
Algumas anotações feitas durante a RuPy Campinas 2015.
View A evolução de uma arquitetura distribuí

Autor: Guilherme Garnier


  • Plataforma de vídeos: requisições pra diabo + vídeos pra diabo

  • Monolito: projeto Rails imenso blabla, eventualmente fodeu tudo para manter

  • Vários pontos interessantes

  • Circuit Breaker: ver gem; ver post do Martin Fowler

  • github: cap_blue_green_deploy

agarie /
Last active Sep 23, 2021
XMonad cheatsheet, resources, etc.



  • Mod + Shift + Enter -> Open console
  • Mod + Space -> Change tiling mode
  • Mod + j & Mod + k -> Move focus between windows
  • Mod + Shift + c -> Close the focused window
  • Mod + . & Mod + , -> Control the number of windows displayed in the master pane on the left
  • Mod + Enter -> Move the focused window to the master pane on the left
agarie / rng.lua
Created Jun 12, 2015
RNGs for some distributions written in Lua, mostly as a first exercise in the language.
View rng.lua
-- Some RNGs for getting to play with Lua.
-- Carlos Agarie <>
-- Public domain.
-- N(mean; std^2).
function gauss(mean, std)
if std <= 0.0 then error("standard deviation must be positive!") end
agarie / create_has_library.rb
Created May 23, 2015
A function for inquiring if a library is available. Automatically requires the library if it is available.
View create_has_library.rb
# Create a method `has_<library>?` on Module that requires the library and
# return a boolean indicating if the library is available.
# @param library [String] The library name.
# @return [Boolean] Whether the library is available or not.
def create_has_library(library) #:nodoc:
define_singleton_method("has_#{library}?") do
cv = "@@#{library}"
unless class_variable_defined? cv