Skip to content

Instantly share code, notes, and snippets.

View marsam's full-sized avatar
🇵🇸
From the river to the sea, Palestine will be free 🇵🇸

Mario Rodas marsam

🇵🇸
From the river to the sea, Palestine will be free 🇵🇸
View GitHub Profile
@marsam
marsam / ansibledoc.el
Created July 30, 2014 19:53
Ansible documentation from Emacs
;;; ansibledoc.el --- Ansible documentation from Emacs -*- lexical-binding: t -*-
;; Author: Mario Rodas <[email protected]>
;; Version: 0.0.1
;; This file is NOT part of GNU Emacs.
;;; License:
;; This program is free software; you can redistribute it and/or modify
@marsam
marsam / tweetshot.js
Last active July 25, 2016 11:08
tweetshot --- take screenshot to tweets
#!/usr/bin/env phantomjs
/*global phantom: false */
'use strict';
var system = require('system')
, args = system.args
, page = require('webpage').create()
;
var tweetshot = function(url, output, width, height) {
@marsam
marsam / shitdone
Last active August 29, 2015 14:03
Get shit DONE
#!/usr/bin/env bash
#
# TODO:
# - Use tc/netem: http://linux.die.net/man/8/tc
set -eo pipefail
typeset config="$HOME/.shitdone.conf"
typeset iptables_bkp="$HOME/shitdone.iptables.rules"
# -*- mode: ruby -*-
# vi: set ft=ruby :
CADVISOR_ARGS = %w{--volume=/var/run:/var/run:rw
--volume=/sys/fs/cgroup/:/sys/fs/cgroup:ro
--volume=/var/lib/docker/:/var/lib/docker:ro
--publish=8080:8080
--detach=true
}.join(" ")
#!/bin/bash
# load resources
xrdb -merge .Xresources
#xsetroot -solid '#222'&
# map caps lock as extra escape
xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'&
# start clipboard manager
parcellite&
@marsam
marsam / dtl-pitch.md
Created April 30, 2014 03:45
DTL picth

If you want a take-home tag line for DTLs, here you go:

A dependently-typed language is one where the type system is the same as the language itself.

This means that types are first-class objects. You can pass them as arguments. You can return them as return values.

In a function signature, you may give names for all your arguments. For example: index : (n : Nat) -> List Int -> Int.

The names are brought into scope inside the type. This means that arbitrary values may end up living "inside the types". A "better" version of the type above might be index : (n : Nat) -> Vect n Int -> Int. Here, we use Vect instead of List -- the difference is that a Vect n A is known to have exactly n elements of type A. (In constrast, a List A might have fewer or more than n elements).

# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |c|
c.vm.box = "thoughtpolice/nixos-13.10"
c.vm.provider "virtualbox" do |vb|
vb.gui = false; vb.memory = 4096; vb.cpus = 2
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
@marsam
marsam / ftpmirror
Last active April 3, 2018 17:00
ftp mirror
#!/usr/bin/env bash
set -e
host="ftp.example.com"
user="user"
pass="pasword"
ftpurl="ftp://${user}:${pass}@${host}"
local_dir="/path/to/local/dir"
remote_dir="documents" # Only mirror this remote dir
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# See: http://xkcd.com/1335/
#
# Usage:
# $ python xkcd_now.py
# $ convert -delay 10 -loop 0 *.png animation.gif
from __future__ import print_function
@marsam
marsam / blocklist.txt
Last active August 29, 2015 13:56
Personal blocklist
[Adblock Plus 2.0]
! Version: 20140217
! Title: Custom blocklist
! Expires: 5 days
! Homepage: https://gist.github.com/marsam/9061301
! Redirect:
animeultima.tv##div#mini-announcement
animeultima.tv##div#right-content-hp
animeultima.tv##div.notice