Skip to content

Instantly share code, notes, and snippets.

@lopes
lopes / rc.firewall
Created January 2, 2013 18:25
My template to configure iptables.
#!/bin/bash
#rc.firewall
#
#
# Firewall configuration file.
#
#
# AUTHOR: José Lopes Oliveira Jr. <indiecode.com.br>
#
#
@lopes
lopes / chloe.sh
Created January 2, 2013 18:40
A deprecated code that was used to manage my receipt files.
#!/bin/bash
#chloe.sh
# A receipt files' manager.
#
# Author.: José Lopes de Oliveira Júnior
# Website: http://joselop.es
# Licence: GPLv3+
#
@lopes
lopes / puck.sh
Created January 2, 2013 18:42
A DNS propagation checker in Shell Script.
#!/bin/bash
#puck.sh
# A DNS propagation checker. Fetches in many DNS servers around
# the world for IPs assigned to a given domain.
#
# Author: José Lopes de Oliveira Júnior <http://joselop.es>
#
#
@lopes
lopes / war-dialer.sh
Created January 2, 2013 18:51
An deprecated IPv4 war dialer written in Shell Script. It's more like an example on how to make bitwise operations in Bash.
#!/bin/bash
str2int(){
local octet int=0
for octet in $(echo $1 | tr "." " "); do
int=$((int << 8))
int=$((int + octet))
done
echo $int
}
@lopes
lopes / webfortune.sh
Created January 2, 2013 18:54
An obsolete implementation of Fortunes. It reads the last Pensador's tweet, store it and display for the user. 1 tweet a day.
#!/bin/bash
#webfortune.sh
# Retrieves the last @pensador's tweet. Manages it retrieving one
# tweet per day, by using a file to cache the quote.
#
#
# José Lopes de O. Júnior <http://indiecode.com.br>
#
@lopes
lopes / ervilha.sh
Created January 10, 2013 01:04
Displays the sequence until its Nth item, passed through $1. The sequence starts with 1 and its next item will be given by the read of the current item.
#!/bin/bash
#ervilha.sh
#
#
# Displays the sequence until its Nth item, passed through $1.
# The sequence starts with 1 and its next item will be given
# by the read of the current item.
# For exemple, if the 4th item is 1211 --three one and one
# two--, the 5th item will be 3112.
#
@lopes
lopes / macaddr.sh
Created January 24, 2013 12:25
A really simple shell script to identify your NIC's manufacturers according to its MAC addresses.
#!/bin/bash
#macaddr.sh
#
# It will catch all of your network interfaces and
# find out what's the manufacturer of each according
# to its OUI.
#
# José Lopes de Oliveira Jr. <indiecode.com.br>
#
# GPLv3
@lopes
lopes / indipv4.py
Created February 25, 2013 17:40
A class to handle IPv4 addresses. You can try it by running directly this script.
#!/usr/bin/env python
#coding: utf8
"""IP
Provides a class that stores an IPv4 address like an
integer number. But it is transparent to the user.
"""
@lopes
lopes / sync-bkps.sh
Last active December 14, 2015 05:49
Syncs backups from different servers in a single file server.
#!/bin/bash
#sync-bkps.sh
#
# Syncs backups from different servers in a single
# place, using rsync. This "single place", in this
# case is a shared folder in a Windows 2008 system.
# So, we have to mount it using Samba first.
#
# AUTHOR.: José Lopes de Oliveira Jr. <indiecode.com.br>
# LICENSE: GPLv3+
@lopes
lopes / pack.sh
Last active December 18, 2015 01:19
Packs an entire directory by zipping and encrypting it.
#!/bin/bash
#pack.sh
#
# Zips and crypts a directory.
#
# TODO
# - Ask confirmation before delete.
##
OUTPUT="$(basename $(pwd))" #current dirname