Skip to content

Instantly share code, notes, and snippets.

View pcapriotti's full-sized avatar

Paolo Capriotti pcapriotti

View GitHub Profile
@pcapriotti
pcapriotti / i3-exit
Created March 28, 2017 12:46
lock/logout script
#!/bin/bash -e
WALLPAPER_DIR="$HOME/backup/content/pictures/wallpapers"
function lock() {
local wp="$(scaled_wallpaper)"
local cmdline=""
[ -z "$wp" ] || cmdline="-i $wp"
function revert() {
@pcapriotti
pcapriotti / allrepos
Last active May 14, 2018 15:22
List all personal repositories from git hosting services
#!/bin/bash
set -e
usage() {
echo "Usage: $0 USERNAME" 2>&1
exit 1
}
username="$1"
[ -z "$username" ] && usage
@pcapriotti
pcapriotti / pagination_link
Last active April 8, 2019 19:29
Extract next link from HTTP header
@pcapriotti
pcapriotti / newgist
Last active December 7, 2016 21:28
Script to create a new gist
#!/bin/bash
set -e
usage() {
echo "Usage: $0 [-f FILE] [-n NAME] [-l LANGUAGE] [-p] [-d] DESCRIPTION" 2>&1
exit 1
}
public=true
dryrun=false
@pcapriotti
pcapriotti / arxiv.sh
Created December 7, 2016 18:20
ArXiv submission script
#!/bin/bash
# prepare submission tarball for arXiv.org
set -e
usage() {
echo "Usage: $0 DEST SOURCE..."
exit 1
}
on_exit() {

Keybase proof

I hereby claim:

  • I am pcapriotti on github.
  • I am pcapriotti (https://keybase.io/pcapriotti) on keybase.
  • I have a public key whose fingerprint is 2461 C117 39FE 5784 858C 9F18 DF96 7258 59FA 1C1F

To claim this, I am signing this object:

module m where
open import sum
open import equality
open import function
open import sets.nat
open import sets.unit
open import hott.level.core
module _ (A : Set)(B : A → Set) where
@pcapriotti
pcapriotti / git-branch-status.sh
Created July 31, 2012 14:54
summary of branches
#!/bin/bash
# based on https://gist.github.com/1288596
RED="\033[0;31m"
YELLOW="\033[0;33m"
GREEN="\033[0;32m"
NOCOLOR="\033[00m"
BOLD="\033[1;37m"
git for-each-ref --format="%(refname:short) %(upstream:short)" refs/heads | \
while read local remote
@pcapriotti
pcapriotti / pipes.hs
Created June 8, 2012 16:24
Another Pipe experiment
{-# LANGUAGE CPP, GADTs, KindSignatures, TypeFamilies, DataKinds #-}
import Control.Monad
type family If (t :: Bool) a b
type instance If True a b = a
type instance If False a b = b
data Pipe a b (t :: Bool) m r where
Pure :: r -> Pipe a b t m r
@pcapriotti
pcapriotti / exists.c
Created June 7, 2012 15:35
CreateFile example
#include <windows.h>
#include <stdio.h>
int main()
{
HANDLE h = CreateFile(
"bar.txt",
GENERIC_READ | GENERIC_WRITE,
0,
NULL,