Skip to content

Instantly share code, notes, and snippets.

View tatic0's full-sized avatar

fran varas tatic0

View GitHub Profile
@tatic0
tatic0 / macaddresslookup.sh
Created July 2, 2012 14:18
mac address lookup (needs wireshark installed)
#!/bin/bash
if [[ ! $1 ]]
then echo "Usage: $0 <mac address>"
exit 1
else
mac=$1
#echo ${mac:0:8}
oui=${mac:0:8}
grep -i $oui /usr/share/wireshark/manuf
@tatic0
tatic0 / README
Created July 3, 2012 09:14
colours in bash
BaSH color examples
@tatic0
tatic0 / README
Created September 8, 2012 13:44
progress bar using zenity
zenity example
@tatic0
tatic0 / filekeeper.py
Created September 29, 2012 13:34
detect duplicated files
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# filekeeper.py
import os, sys, hashlib, fnmatch
# TODO
# os.link(source, link_name)
# set to false for quieter output
@tatic0
tatic0 / ifping.sh
Last active October 11, 2015 15:27
as soon as the server replies to ping, do something
#!/bin/bash
# ifping.sh
# f varas 10 2012
##
## you need to have sshpass or ssh-key
## to grant "passwordless" access to the servers
# execute an action when remote server replies to ping
counter=1
@tatic0
tatic0 / nyan.sh
Created October 15, 2012 12:05
bash nyan cat
#!/bin/bash
# nyan.sh
NYAN="~=[,,_¸¸]:3"
length=0
for length in {1..100}; do
clear
printf -v line '%*s' "$length"
@tatic0
tatic0 / gist:4160731
Created November 28, 2012 12:02 — forked from yyuu/gist:1569253
df in python on Linux
#!/usr/bin/env python
# df.py
# inispirational code taken from:
# https://gist.github.com/1569253
from __future__ import with_statement
import contextlib
import os
import sys
@tatic0
tatic0 / launcher.sh
Created December 8, 2012 17:53
for testing purposes I need to keep a small python http engine alive
#!/bin/bash
# launcher.sh
while true; do if [[ ! $(ps -ef |egrep "python.*[m]ain") ]] ; then echo "server down"; ./main.py; fi; sleep 10; done
@tatic0
tatic0 / volume.sh
Last active September 4, 2016 17:28
set amixer volume with zenity
#!/bin/bash
# script to change the volume using amixer + zenity
current_vol=$(amixer -c 0 get 'Master' |tail -1| sed 's/.*\[\([0-9][0-9]\%\)\].*/\1/g'| sed 's/%//g')
function volume {
VOLVALUE=$(zenity --scale --value=$current_vol --text "set volume")
CMD="amixer -c 0 set 'Master' $VOLVALUE%"
echo $CMD
@tatic0
tatic0 / geoip.php
Created February 7, 2013 11:48
parse a list of IPs and return the country where the IP is using GeoIP
<?php
error_reporting(0);
$data = file('failIP.text');
foreach ($data as $line) {
$host = trim($line);
$country = geoip_country_name_by_name($host);
if ($country) {
echo 'Host '.$host. ' is located in: '.$country. "\n";