Skip to content

Instantly share code, notes, and snippets.

View dinigo's full-sized avatar

Daniel Iñigo dinigo

View GitHub Profile
@dinigo
dinigo / afp.conf
Last active August 31, 2023 21:50 — forked from mAAdhaTTah/1_netatalk-3-install-on-ubuntu-14.04.sh
Install netatalk (afp) in Ubuntu with service announcing and provide a Time Machine share. Users must belong to `timemachine` group to be allowed to use it.
[TimeMachine]
path = /store/time-machine
time machine = yes
valid users = @timemachine
@dinigo
dinigo / AmigoInvisible.java
Created November 25, 2013 18:11
Programa para asignar parejas de amigo invisible. A partir de un archivo de texto con una lista de nombres (uno por linea) crea un archivo de texto para cada persona (que no debe abrirse, claro) y que debe enviarse como adjunto por correo electrónico (o cualquier otro medio personal)
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Random;
@dinigo
dinigo / aria2.conf
Created December 14, 2014 17:56
Aria2c config files and init scripts
# place under ${HOME}/.aria2/
# Daemonize, rpc and session save.
# The daemon is launched by the rpc query and
# stops when all downloads are completed.
continue
daemon=true
on-download-complete=exit
dir=/home/**youruser**/path/to/download/folder
@dinigo
dinigo / add_user.py
Created October 3, 2017 08:18
Add user to Airflow
#!/usr/bin/python
# This little script creates users in an airflow instance so it can be open to the public.
# It gets the password in plain text so be careful where you run it.
# You can properly invoke the script as follows:
# ./add_user.py <username> <user@email.com> <secretpassword>
import airflow, sys
from airflow import models, settings
from airflow.contrib.auth.backends.password_auth import PasswordUser
@dinigo
dinigo / template.tex
Last active June 27, 2018 14:10
LaTeX template for IEEEtrans package. I use it for assignments at college.
% -*-coding: utf-8 -*-
% You MUST redefine margins before \documentclass{IEEEtran}
\newcommand{\CLASSINPUTinnersidemargin}{18mm}
\newcommand{\CLASSINPUToutersidemargin}{12mm}
\newcommand{\CLASSINPUTtoptextmargin}{20mm}
\newcommand{\CLASSINPUTbottomtextmargin}{25mm}
\documentclass[10pt,conference,a4paper]{IEEEtran}%
  1. Dependencies
  • brew: run /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • node and npm: run brew install node npm
  1. Download the script
  2. Give permissions to run chmod +x install_ssl.sh
  3. Run ./install_ssl.sh
  4. Trust the cert
  • Run open ~/.config/ssl
  • Double click the cert
  • Double click the cert inside keychain
@import url('https://fonts.googleapis.com/css?family=Roboto');
body {
background: #e2e1e0;
text-align: center;
}
.card {
padding: 16px;
font-family: 'Roboto', sans-serif;
background: #fff;
@dinigo
dinigo / README.md
Last active December 18, 2017 17:35
Basic Assert in javascript ES5 (syntax) for Appscript

Example:

Assert.true(true,'This is truthful');
Assert.true(false,'This is truthful');
Assert.false(false,'This is a lie');
Assert.false(true,'This is a lie');
Assert.equals(typeof 'hola', 'string', 'This variable contains a message');
Assert.equals(typeof 3, 'string', 'This variable contains a message');

Result:

@dinigo
dinigo / README.md
Last active December 14, 2017 23:44
Cache requests instead of firing them to the API

Cached Runner

Receives a period of time and a request function, and performs all async operations to get the data. If you retry the request in a time shorter than the period it returns the cached result instead.

You can also set a postprocess function and another function that runs every time.

Simple example

Usage

const simpleCahedRun = new CachedRun(2500, ()=&gt;Math.random());
@dinigo
dinigo / README.md
Last active November 30, 2017 10:12
Basic scheduler for google cloud functions

PURPOSE

It's not trivial to deploy a cron scheduler on Google Cloud. Here I purpose a simple way to prototype it. Since most part of tasks will only need a basic frequency trigger the hourly / daily / weekly / monthly percision will suffice.

1. Create the Appscript on Google Drive

Just drop the appscript.gs code insdie a freshly created appscript project. Name the project with an easily recognizable name since Google Drive doesn't let you filter by appscript file type.

2. Add the triggers