Skip to content

Instantly share code, notes, and snippets.

View agarie's full-sized avatar

Carlos Agarie agarie

View GitHub Profile
@agarie
agarie / rgb2cmyk.sh
Created January 20, 2017 18:59
Convert the colors of a PDF file from RGB to CMYK for printing.
#!/usr/bin/zsh
gs -dSAFER -dBATCH \
-dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite \
-sColorConversionStrategy=CMYK \
-dProcessColorModel=/DeviceCMYK \
-sOutputFile=$2 \
$1
@agarie
agarie / download-conf-papers.rb
Last active December 12, 2017 02:36
Quick script I made to download papers from NIPS. The subjects are specified in `SUBJECTS_RE`.
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)
"https://papers.nips.cc/book/advances-in-neural-information-processing-systems-#{issue}-#{1987 + issue}"
@agarie
agarie / parse_wp_exported_posts_backup.rb
Created December 6, 2021 17:47
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".
# 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'
WP_POSTS_SQL_FILE = ARGV[0]
WP_POSTS_CSV_FILE = WP_POSTS_SQL_FILE + ".csv"
@agarie
agarie / create-posts-from-csv.rb
Created December 10, 2021 20:05
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.
#!/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"