Skip to content

Instantly share code, notes, and snippets.

View logc's full-sized avatar

Luis Osa logc

View GitHub Profile

Template

Heading

@logc
logc / cal.tex
Created January 19, 2020 14:02
Yearly planner calendar
\documentclass[14pt]{scrartcl}
%% Translate month names
\usepackage[spanish]{babel}
\usepackage[spanish]{translator}
\usepackage{tikz}
\usetikzlibrary{calendar}
@logc
logc / mkscala.fish
Created April 26, 2019 15:26
Create a Scala project from Fish shell
function mkscala --argument proj org tld
set -q tld[1]
or set tld "com"
set -q org[1]
or set org "example"
echo "Creating a Scala project called" $proj
mkdir -p $proj/{project,src}
mkdir -p $proj/src/{main,test}/{java,scala,resources}
mkdir -p $proj/src/{main,test}/scala/$tld/$org/$proj
@logc
logc / booklet.tex
Created February 13, 2019 09:42
Reorder pages of a PDF file so that it can be printed as a booklet
\documentclass{scrartcl}
\usepackage{pdfpages}
\begin{document}
%% Edit the name of the PDF file
\includepdf[pages=-,booklet,landscape]{another.pdf}
\end{document}
@logc
logc / fib.nim
Created April 10, 2018 09:27
How to call Nim from Racket
proc fib(a: cint): cint {.exportc, dynlib.} =
if a <= 2:
result = 1
else:
result = fib(a - 1) + fib(a - 2)
@logc
logc / mkscons.fish
Created November 28, 2017 20:46
Create a basic SCons project as Fish function
function mkscons --argument proj
mkdir -p $proj/include/core
mkdir -p $proj/src/core
mkdir -p $proj/tests/core
###############################################################################
# BUILD SCONSCRIPT
printf "\
env = Environment(CPPPATH=['include'])
env.Library(target='$proj', source=Glob('src/core/*.c'))
env.Program(target='$proj', source=Glob('src/*.c'),
@logc
logc / max_column_sum_by_key.rkt
Last active September 17, 2017 20:31
Faster Command Line Tools in Racket
#lang typed/racket/base
(require racket/cmdline
racket/string)
(: parse (-> String Integer Integer (Values String Integer)))
(define (parse line key-field-pos val-field-pos)
(let ([fields (string-split line "\t")])
(values (list-ref fields key-field-pos)
(assert (string->number (list-ref fields val-field-pos))
@logc
logc / calendar_reminder.py
Last active June 8, 2017 10:00
Script to retrieve events from a Google Calendar, check if any of them happens tomorrow earlier than 11AM, and set a reminder in Reminders.app for today at 9PM
#!/usr/bin/env python
"""
Script to retrieve events from a Google Calendar, check if any of them happens
tomorrow earlier than 11AM, and set a reminder in Reminders.app for today at
9PM
"""
import argparse
import datetime
import sys
import os
#lang typed/racket/base
(require racket/future)
(require racket/performance-hint)
(require racket/cmdline)
(require (only-in racket/unsafe/ops
unsafe-car
unsafe-cdr))
(require (rename-in racket/unsafe/ops
[unsafe-fx+ +]
[unsafe-fx- -]
@logc
logc / pypkg.sh
Last active March 8, 2017 09:48
Python packages with Sphinx & Github pages
#!/usr/bin/env bash
pkg_name=$1
pkg_root=$PWD/${pkg_name}
doc_root=${pkg_root}/docs/_build/html
hostname=`hostname`
year=`date '+%Y'`
version='0.1.0'