Skip to content

Instantly share code, notes, and snippets.

View ssaavedra's full-sized avatar

Santiago Saavedra ssaavedra

View GitHub Profile
@ssaavedra
ssaavedra / fix-vodafone-router.user.js
Last active March 19, 2018 18:49
Fix Vodafone's router UI to be able to auto-fill the user/password again
// ==UserScript==
// @name Fix dumb "new" Vodafone router page
// @namespace http://192.168.1.1//
// @include /http:\/\/(192\.168|10\.(\d{1,3})|172\.(\d+))\.(\d+).1\/login.html/
// @license https://opensource.org/licenses/MIT
// @grant none
// ==/UserScript==
// Uses a regex so that your router can be configured on any local IP.
@ssaavedra
ssaavedra / create-aws-repo.sh
Created May 10, 2017 12:32
Create an AWS ECR repository and add a policy to it from an already existing repo.
#!/bin/bash
# Author: Santiago Saavedra
# License: CC0
# Usage: $0 --help
POLICY_REPOSITORY=${AWS_DEFAULT_ECR_POLICY_REPOSITORY:-policy-repo}
usage () {
cat <<-EOF | awk 'NR==1 && match($0, /^ +/){n=RLENGTH} {print substr($0, n+1)}'
Usage: $0 <aws-repository-name>
@ssaavedra
ssaavedra / using-emacs-to-write-clir-files.md
Last active November 18, 2016 16:40
How to use Emacs to write CLIR files

This is a Beginners Guide to writing CAVI-ART's CLIR files using Emacs, for people who has never used Emacs.

Introduction to Emacs

Emacs is a editor very leaned to using the keyboard as the primary input method. Thus, most commands on Emacs can be entered through the keyboard, although most can also be entered through the toolbar with the mouse.

@ssaavedra
ssaavedra / operator.hs
Created November 7, 2016 13:30
Haskell and higher-order polymorphism. Intuitionstic logic and type theory.
{-# LANGUAGE RankNTypes #-}
module Operator
where
(***) f g (x1, x2) = (f x1, g x2)
f :: [a] -> [a]
f = snd . splitAt 1
type GType a = ([a], [a])
@ssaavedra
ssaavedra / 5_cpu_percent
Created September 5, 2016 16:32
Get the CPU usage as a percentage. Great for use inside byobu/tmux, but can be used standalone.
#!/bin/bash
#
# 5_cpu_percent: get the global CPU usage as a percentage
#
# Copyright (C) 2016 Santiago Saavedra
#
# Authors: Santiago Saavedra <santiagosaavedra@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ssaavedra
ssaavedra / roswell.spec
Last active September 8, 2016 16:55
roswell specfile
Name: roswell
Version: 0.0.6.65
Summary: A lisp installer and launcher for major environments that just work
Release: 1%{?dist}
License: MIT
URL: https://github.com/roswell/roswell/
Source0: https://github.com/roswell/roswell/archive/v%{version}.tar.gz
Group: Development/Tools
BuildRequires: libcurl-devel
#!/usr/bin/env python3
# -*- coding: utf-8; -*-
# Author: Santiago Saavedra <ssaavedra@gpul.org>
# License: MIT
# Description:
# This script detects raspberries and sorts them by last-seen time.
# It also tries to inspect whether they still have their default
# password set.
# We found it specially interesting in IoT Hackathons and the like
# for participants to easily spot theirs (and actively remember
(defpackage :mypackage
(:use)
(:export :let))
(defpackage :mypackage.impl
(:use :cl))
(in-package :mypackage.impl)
(defmacro mypackage:let (a)
@ssaavedra
ssaavedra / .gitignore
Last active April 7, 2016 15:36
CLIR Attempt
*~
*.swp
*.fasl
*.FASL
*.lisp-temp
@ssaavedra
ssaavedra / tco.lisp
Created March 30, 2016 13:46
Improve TCO handling on Common Lisp easy cases
(defpackage :ssaavedra.tco
(:documentation
"Implements some silly optimizations for improved Tail Call
Optimization (TCO) so that when defining a function or a lambda ending
in a `case' or an `if' the enclosing frame can be removed.")
(:use :common-lisp)
(:export :tco-body :case-tco :defun-tco))
(in-package :ssaavedra.tco)
(defun tco-test ()