Skip to content

Instantly share code, notes, and snippets.

@lf-araujo
lf-araujo / 2015-11-3-gtk-boxes.Rmd
Created August 21, 2018 17:36
Designing the Window with Boxes
*This is part of a series of posts about the Genie programming language. I am updating my progress in learning the language from scratch in the hopes it will be useful for anyone also trying to get to programming in the linux/Gtk world.*
This is an improved design than the previous exercise. The objective is very similar, but now with boxes to hold the structure of the window.
```vala
/* Compile with: valac --pkg gtk+-3.0*/
[indent=4]
uses Gtk
@lf-araujo
lf-araujo / 2015-12-21-How-to-sync-your-documents-with-google-docs-in-Ubuntu.Rmd
Created August 21, 2018 17:36
How to Sync Your Documents with Google Docs in Ubuntu
Here is an example of how to have your documents periodically synced to google docs. We will be using two Unix tools: [ grive ](https://github.com/Grive/grive) and [ cron ](http://en.wikipedia.org/wiki/Cron).
## Installing grive
You can install grive simply by calling:
```bash
sudo apt-get install grive
```
@lf-araujo
lf-araujo / 2016-02-21-Review-progress.Rmd
Created August 21, 2018 17:38
Reviewing My Progress with Genie
*This is part of a series of posts about the Genie programming language. I am updating my progress in learning the language from scratch in the hopes it will be useful for anyone also trying to get to programming in the linux/Gtk world.*
## Regular expressions made easy
Some time ago I came across a Python class that was designed to make [regular expressions]( https://en.wikipedia.org/wiki/Regular_expression) easier for [beginners]( https://www.reddit.com/r/Python/comments/3zpgj1/pythonverbalexpressions_regular_expressions_made ). It essentially makes this easily to type but baffling code:
```
^https?://(?:www\\.)?[^\s]$
@lf-araujo
lf-araujo / 2016-03-22-A-Working-Txt.md
Last active March 31, 2019 10:41
A Working Text Editor in Genie

This is part of a series of posts about the Genie programming language. I am updating my progress in learning the language from scratch in the hopes it will be useful for anyone also trying to get to programming in the linux/Gtk world.

I am translating part of the exercises from the book Gtk development from Andrew Krause. This time the aim is to create a small text editor with some functionality. It must:

  1. allow copy/pasting
  2. create new texts
  3. saving the present file
  4. and search capabilities

Note that I am incorporating the suggestions from the systematic program design course and for each function there is a stub, a definition and an example of use of the function. This is causing the program to have a lot of commented code. If you follow the tutorial to allow Genie code folding in the Geany text editor you will be fine, though.

@lf-araujo
lf-araujo / 2016-07-21-Changing-directions.md
Last active March 31, 2019 10:41
Changing Directions in the Design of the Text Editor

This is part of a series of posts about the Genie programming language. I am updating my progress in learning the language from scratch in the hopes it will be useful for anyone also trying to get to programming in the linux/Gtk world.

The number of private fields for the object created to handle the different functionalities of the editor was increasing, as the functionalities were being added. I worried that would lead to harder maintenance of the code in the future and asked about alternatives at SO.

It turns out, in order to escalate the software the approach I taken wasn't good enough. I was suggested to switch to a behaviour oriented design and to use interfaces, since I will probably want to enable key combinations to activate certain functionalities in it.

It seems that designing objects is a fairly difficult task. The simple change to the suggested design required quite a bit of reading in order to work pr

@lf-araujo
lf-araujo / 2016-09-24-Yet-Another-CV.md
Last active March 31, 2019 10:41
Yet Another Pandoc CV Template

It is always nice when you come across good typography from LaTeX documents. Up until recently, the easiest way of dealing with LaTeX syntax was through the installation and use of Lyx. Fortunately, pandoc was created (it is ten years old now), making things a lot easier.

I've been using a custom CV template for some months, and finally I feel it is worth sharing to a broader audience.

Here is how it looks:

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

The dependencies for it are:

@lf-araujo
lf-araujo / 2016-10-23-Workflow.md
Last active March 31, 2019 10:41
A Programming Workflow for the Genie Programming Language

There aren't multiple text editors able to handle syntax highlighting and code folding for this new language. The editor that supports most features now is Geany and here is how to configure it to the task. If you haven't already, go install Geany.

Template for gs files

Create a file in ~/.config/geany/templates/ with the name main.gs and save the following content into it.

/*
 * {untitled}.gs
@lf-araujo
lf-araujo / 2016-11-5-Bash.md
Last active March 31, 2019 10:41
Quick Rendering PDFs from Markdown in Gedit

This script is meant to be run in any text editor that has the ability to run external commands. It should work in any Unix system (perhaps BSD as well, not tested).

It has been tested in Gedit, but can be configured to run in other text editors as well. All the needed steps is to create an external command (both editors support this feature), define a keyboard shortcut (mine is Ctrl+Alt+P) and paste the following as the command:

#!/bin/sh

if [ -f preamble.tex ]
then
 FLAGS=$FLAGS'-H preamble.tex'
@lf-araujo
lf-araujo / 2016-11-6-Bash2.md
Last active March 31, 2019 10:40
Bash Script for Quick Rendering PDFs from Markdown in the Clipboard

Bash Script for Quick Rendering PDFs from Markdown in the Clipboard

This is a continuation of the previous post. Now this solution is editor independent. It will take any selection from the clipboard and create a PDF from it. The objective of such a script is to allow the generation of PDFs from online collaboration tools like Google Docs. Ask the coauthor to write using markdown and you can generate the PDF on the go, once it is ready to publication.

It will look for header.yaml, preamble.tex and template.tex in the open desktop standard Template directory. For this reason it will not work in Macintosh systems.

It depends, as the previous script, in pandoc, pandoc-citeproc, LaTeX and xsel. The last is easily installable in any Linux system.

First, create a file named autopander and paste the following:

@lf-araujo
lf-araujo / 2016-11-7-mdworkflow.md
Last active March 31, 2019 10:40
Scientific Writing Workflow with Pandoc

Markdown is a markup language. It was originally developed as a way of writing html in a readable format. There are several implementations for it, and it is reasonable to say that the Pandoc implementation is the most complete one.

Markdown has long surpassed the uses it was originally designed for. One can use Markdown in multiple settings now. For instance, it is possible to write a blog in it, publish entire sites using this language, write emails and generate PDFs with great typography. Something that was once only possible for LaTeX users. Complete installation instructions can be found at Pandoc's website.

The reason why it is so appealing for science is that it decouples formatting from content, so that the researcher can write without worrying about the style the journal wants. It also helps improve the formatting inconsistencies that creeps in while collaborating in word docume