Skip to content

Instantly share code, notes, and snippets.

View agarie's full-sized avatar

Carlos Agarie agarie

View GitHub Profile
@agarie
agarie / index.html
Created May 6, 2012 03:55
CSS buttons for pokémon types.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Pok&eacute;mon Buttons for each type</title>
<link rel="stylesheet" type="text/css" href="./types.css" />
</head>
<body>
<div class='container'>
<span class="type normal left">normal</span>
@agarie
agarie / type-chart.json
Last active March 20, 2023 00:27
Pokémon type chart as a JSON.
{
"normal": {
"normal": 1,
"fire": 1,
"water": 1,
"electric": 1,
"grass": 1,
"ice": 1,
"fighting": 1,
"poison": 1,
@agarie
agarie / quotes_generator.rb
Last active July 1, 2022 15:12
A jekyll plugin to generate a quotes index page from a quotes.json file.
#------------------------------------------------------------------------------
# QuotesGenerator
# A Jekyll plugin to generate a quotes/index.html page based on a Tumblr's
# account.
#
# You need a quotes.json file inside a SITE_ROOT/_data/ directory to use this
# plugin. It must use the same format as Tumblr's API v2.
#
# Available _config.yml settings:
# - text_size_limit: Maximum size of a used quote. Default to 1000.
@agarie
agarie / tokyotosho.rb
Last active July 1, 2022 15:07
Utility to download torrent files from tokyotosho.info. It uses a similar heuristic to my own when looking for torrents, but could use some improvements.
#!/usr/bin/env ruby -w
require 'open-uri'
require 'uri'
require 'nokogiri'
DEFAULT_DIR = "/Users/carlosagarie/torrents"
CATEGORY = 1 # Anime.
# Regular expressions and constants for extraction.
@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"
@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 / xmonad.md
Last active September 23, 2021 09:05
XMonad cheatsheet, resources, etc.

xmonad

Shortcuts

  • 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
/*
** queue-threadsafe.c
**
** A thread-safe (for 2 threads) implementation of a queue. Based on the
** implementation from the book Embedded Systems, by Jonathan W. Valvano,
** chapter 3, page 130.
*/
#include <stdlib.h>
@agarie
agarie / gist:4753170
Created February 11, 2013 07:54
Installing ruby-opencv on OS X.
# Use Homebrew and be happy.
brew update
brew install opencv
# Give the correct pathnames. Of course, `2.4.3` is the current version at this time, change it accordingly.
gem install ruby-opencv -- --with-opencv-lib=/usr/local/Cellar/opencv/2.4.3/lib \
--with-opencv-include=/usr/local/Cellar/opencv/2.4.3/include/opencv \
--with-opencv-include=/usr/local/Cellar/opencv/2.4.3/include/opencv2
@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}"