Skip to content

Instantly share code, notes, and snippets.

@mbelletti
mbelletti / mikrotik.cfg
Created August 29, 2016 19:12
Troubleshooting mikrotik
# jun/12/2016 10:08:13 by RouterOS 6.35.2
# software id = NS6T-J47L
#
/interface bridge
add name=bridge-guests
add name=bridge-media
add name=bridge-phones
add name=bridge-storage
add name=bridge-users
add name=bridge-vms
@mbelletti
mbelletti / Fill_mikrotik_config.bash
Created August 29, 2016 17:54 — forked from elmariofredo/Fill_mikrotik_config.bash
L2TP IPSEC VPN Auto config for mikrotik based on following tutorial http://www.nasa-security.net/mikrotik/mikrotik-l2tp-with-ipsec/ !!! Edit user name/user pass and ipsec secret
# Fetch and fill config
mikrotik_vpn_config=$(curl https://gist.github.com/elmariofredo/7232556/raw/VPN-L2TP-IPSEC.mikrotik \
| sed -e '
s/IPSEC_PEER_SECRET/somesecret/g;
s/USER1_NAME/mario/g;
s/USER1_PASS/somepass/g;
s/IP_RANGE/172.16.24.100-172.16.24.200/g;
s/DNS_SERVER/172.16.22.1/g;
s/LOCAL_ADDRESS/172.16.22.1/g;
s/WINS_SERVER/172.16.22.1/g')
@mbelletti
mbelletti / getBlockLists.sh
Created September 27, 2015 18:23 — forked from johntyree/getBlockLists.sh
Make one large blocklist from the bluetack lists on iblocklist.com
#!/usr/bin/env sh
# Download lists, unpack and filter, write to stdout
curl -s https://www.iblocklist.com/lists.php \
| sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \
| xargs wget -O - \
| gunzip \
| egrep -v '^#'
@mbelletti
mbelletti / .screenrc
Last active August 29, 2015 14:22 — forked from Coomer/.screenrc
altscreen on
hardstatus on
hardstatus alwayslastline
startup_message off
termcapinfo xterm ti@:te@
hardstatus string " %{= kC}%-w%{.rW}%n %t%{-}%+w %=%{..C} %H %{..C} %m/%d "
defscrollback 1000
# Bind C-a v to copy buffer to Mac OS X clipboard.
bind v eval "writebuf" "exec sh -c 'pbcopy < /tmp/screen-exchange'"
@mbelletti
mbelletti / pg_backup.py
Last active August 29, 2015 14:16 — forked from ildus/pg_backup.py
#!/usr/bin/env python
#coding: utf-8
from optparse import OptionParser
from datetime import date, datetime
from pwd import getpwnam
import unidecode
from libs.script_utils import get_email_logger
import getpass
# Add multimedia source
echo "deb http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
echo "deb-src http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
apt-get update
apt-get install deb-multimedia-keyring # if this aborts, try again
apt-get update
# Go to local source directory
cd /usr/local/src
@mbelletti
mbelletti / brew_bash_completion.sh
Created May 29, 2014 14:05
brew_bash_completion.sh fow homebrew-cask
# Bash completion script for brew(1)
#
# To use, add the following to your .bashrc:
#
# . $(brew --repository)/Library/Contributions/brew_bash_completion.sh
#
# Alternatively, if you have installed the bash-completion package,
# you can create a symlink to this file in one of the following directories:
#
# $(brew --prefix)/etc/bash_completion.d
# Copyright (c) 2011, Xabier (slok) Larrakoetxea
# Copyright (c) 2011, Iraide (Sharem) Diaz
#
# 3 clause/New BSD license:
# opensource: http://www.opensource.org/licenses/BSD-3-Clause
# wikipedia: http://en.wikipedia.org/wiki/BSD_licenses
#
#-----------------------------------------------------------------------
# This script allows to upload to Fileserve with FTP various files at the same time
#
# Something in lines of http://stackoverflow.com/questions/348630/how-can-i-download-all-emails-with-attachments-from-gmail
# Make sure you have IMAP enabled in your gmail settings.
# Right now it won't download same file name twice even if their contents are different.
import email
import getpass, imaplib
import os
import sys
detach_dir = '.'
@mbelletti
mbelletti / shellista.py
Created November 29, 2012 23:38 — forked from pudquick/shellista.py
Advanced shell for Pythonista
import os, cmd, sys, re, glob, os.path, shutil, zipfile, tarfile, gzip
# You can skip over reading this class, if you like.
# It's an implementation of mine of the bash parser in pure python
# This has advantages over shlex, glob, and shlex->glob in that it expects
# the strings to represent files from the start.
class BetterParser:
def __init__(self):
self.env_vars = {"$HOME": os.path.expanduser('~')}