Skip to content

Instantly share code, notes, and snippets.

@lf-araujo
lf-araujo / Selenops.swift
Created September 20, 2018 12:44
A simple swift web crawler that look for a word of your choosing on the web, starting from a given webpage. Uses Swift, docopt and works on Linux.
/**
* Selenops
* Copyright (c) Federico Zanetello 2017
* Licensed under the MIT license. See LICENSE file.
*/
import Foundation
import Docopt // marathon: https://github.com/lf-araujo/docopt.swift.git
extension Collection where Indices.Iterator.Element == Index {
@lf-araujo
lf-araujo / 2018-06-28-gestures.md
Last active April 30, 2019 13:25
Reactivating gestures after hibernate

Reactivating gestures after hibernate

This is a super quick note on how to reactivate touchpad gestures in Archlinux distributions after hibernation if you use libinput-gestures.

Open you editor, add the following content:

[Unit]
Description=Restart gestures
@lf-araujo
lf-araujo / 2018-01-05-R-REPL.md
Last active August 15, 2019 20:11
R REPL with Sublime Text 3

R REPL with Sublime Text 3

Sublime Text is a closed source expansible text editor, which I use for several tasks. I have shown how to use it as a processor for technical texts, a Read Eval Print Loop (REPL) for the Swift Programming Language. Below I will explain how to do the latter with R as well.

Install Sublime Text REPL add-on

Launch the command palette, with Ctrl + Shift + P and type Install Packages. Now search for SublimeREPL and install it.

@lf-araujo
lf-araujo / 2017-12-11-swift.md
Last active March 31, 2019 10:35
Building a Swift Project in SublimeText

Building a Swift Project in SublimeText

Sublimetext is an expansible document editor that I use for most of my projects. It can become a complete IDE, provided one installs extensions to it. Here is a way of building Swift Programming Language projects with it.

In Tools > Building System > New Building System one can create new building instructions. Paste the following:

{
"cmd": ["swift","build"],
"working_dir":"${project_path:${folder}}",
@lf-araujo
lf-araujo / 2017-10-17-serving.md
Last active March 31, 2019 10:39
Collaborating and Serving Pandoc via Dropbox

It is possible to keep working in a pandoc project even if one is away from the computer. It is even better if this also allows for remote collaboration. There is a hackish way of doing that, of course mighy_make is essential part for the workflow. The below instructions will allow you to copy a markdown text into your Dropbox, which will trigger GNUMake to process the source and generate the output (pdf, epub, Word), which can be then on forwarded. The steps are:

  1. Create a directory in your dropbox folder (I name it mighty_make) and cd into it
  2. Download mighty_make with: wget http://tiny.cc/mighty_test -O Makefile
  3. Prepare the folder structure with make prepare
  4. Optional (for collaboration): Log into your dropbox account and share the directory with your collaborator

Now you need to set the server up, meaning go to the computer in your household that stays online the longer (must be Linux or Mac) and set up a crontab rule. This is done with the command crontab -e and add the followi

@lf-araujo
lf-araujo / 2017-09-17-acronym.md
Last active March 31, 2019 10:39
Acronyms Addon for Mighty_Make

In large documents it is often useful to have a page reserved for the list of acronyms. I've tried several approaches to this and after a discussion at pandoc-discuss the following solution was suggested. The author suggested the use of the package acronyms, but I found it easier to work with the package acro.

It will look like:

![]( /images/Captura de tela de 2017-12-26 20-22-44.png )

This solution comes in the form of a mighty_make theme. The steps to get this going is to download mighty_make's testing branch:

@lf-araujo
lf-araujo / 2017-08-13-letter-again.md
Last active April 14, 2019 20:22
Letter Template Update

Letter Template Update

It's been a while since the creation of Mighty_Make and I have learned more about creating a builder with GNU's Make. The last published example on quickly creating a document with pandoc was a letter pandoc template. Here it will be revisited, as the template received alterations over the last year. As usual the division between style, content, and tool will be followed and this small text will mainly discuss the style.

This is how it looks:

![]( /images/Captura de tela de 2017-12-26 20-18-27.png )

For the production of the pandoc generated documents a strikingly effective workflow uses Sublime Text 3. This alone should take care of most text edition needs.

@lf-araujo
lf-araujo / 2017-04-09-titling.md
Last active April 14, 2019 20:22
LaTeX Titling & Pandoc

In a previous post on how to render complex documents using plain text, it was shown a way to handle titles in the body of the document. This is a good solution for larger documents, but these configurations will only appear if a latex engine is used. There is a way of keeping the title in all pandoc output types as well. That is what will be shown here.

The trick is to use the titling latex package. It allows you to use the standard title variable, which means title will appear in any of the output formats pandoc supports, but also helps to save space and maintain consistency.

I used this method in my PhD thesis and this is how it looked:

![]( /images/Captura de tela de 2017-12-26 20-24-15.png )

Here is an example of how it works. Define the title and authors as you would in any pandoc yaml:

@lf-araujo
lf-araujo / 2017-04-6-swift.md
Last active May 27, 2019 13:12
Swift REPL with Sublime Text in Linux

Swift REPL with Sublime Text in Linux

Swift REPL works fine in Sublime Text. It is a simple three step process. First install the language either by downloading the latest version of it at swift.org and extracting it to /usr, or if you are in Arch by issuing yaourt -S swift-bin.

The second step is to add an option to Swift in Sublime Text REPL. Please note that you have to install Sulime Text REPL first. Launch the Command Palette and browse the packages. Find the SublimeREPL directory and create a config/Swift directory.

Inside this directory, create the file Default.sublime-commands with the following content:

@lf-araujo
lf-araujo / 2016-12-22-going.md
Last active December 16, 2020 12:19
Going PowerPointless with Pandoc

Going powerpointless with Rmarkdown

The previous posts showed how to manage complex documents with pandoc. This last post on the subject will aim at sharing a few yaml headers for presentation and one yaml header for a report. It is very hard to give a good example without images, so this post will have a few of them.

Pandoc can render presentations using the Beamer option. One can run the beamer command with pandoc myfile.md -o presentation.pdf -t beamer. You won't probably need to install anything else, as beamer and the Metropolis theme comes installed in most of modern LaTeX repositories. What I will be doing is a trick to make it look different, by changing the variables within the yaml header.

Metropolis Light version