Skip to content

Instantly share code, notes, and snippets.

@i000313
i000313 / PDFAnnotations.java
Last active January 8, 2024 03:08
Java: Class to get PDF annotations using the itextpdf lib. #java, #pdf, #annotations, #pdf-annotations, #itextpdf
package com.itextpdf;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.PdfArray;
import com.itextpdf.text.pdf.PdfDictionary;
import com.itextpdf.text.pdf.PdfName;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfString;
import com.itextpdf.text.pdf.parser.FilteredTextRenderListener;
import com.itextpdf.text.pdf.parser.LocationTextExtractionStrategy;
@i000313
i000313 / Tsv2ssv.java
Last active December 27, 2015 00:59
Converts a TSV (tab separeted values) into a SSV (space separed values). #tsv #ssv #java
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
@i000313
i000313 / Tokenizer.java
Created April 4, 2014 22:10
This is a tokenizer based on spaces. #java #spacetokenizer #tokenizer
import java.util.Iterator;
import java.util.regex.Pattern;
/**
* Classe que permite dividir um texto em tokens. A divisão é feita com
* base nos espaços encontrados no texto. O tokenizer tem 3 modos de funcionamento.
* Estes modos permitem indicar o que fazer com os símbolos (tudo que não seja uma
* letra nem um número) existentes no início e fim de cada token.
*
@i000313
i000313 / didYouMean.R
Last active August 29, 2015 14:01
R function to get a "did you mean" suggestion from Google #R #didyoumean
############################################################################
# This file has the R functions didYouMean() and didYouMean2().
# The function didYouMean() is a copy found in the "didYouMean.R" file of
# the repository: https://github.com/samcarlos/didYouMean .
#
# The function didYouMean(input) is described below and was originally
# developed by "Sam Carlos". I just wrote a few comments to help me understand
# how this function is implemented. I also added the call to the options(...)
# function, in order to solve a SSL error on Windows 7.
#
@i000313
i000313 / eloRating.R
Last active January 2, 2022 14:37
Elo rating system implementation in R. #elorating #playerskills #ranking
###############################################################################
# Elo rating system implementation in R #
###############################################################################
#
# INTRODUCTION
# The ELO rating system is a method for calculating the relative skill levels
# of players in Player-Versus-Player games. This rating system is used on
# chess and also in a number of games, videogames, etc.
# It was originally invented as an improved chess rating system in the 1960s
# and established at the FIDE-congress 1970 in Siegen (Germany).