Skip to content

Instantly share code, notes, and snippets.

View diogomonica's full-sized avatar

Diogo Mónica diogomonica

View GitHub Profile
void imprime_linha_eli (eli linha_elim,int num_linha){
int x=0;
if (linha_elim != NULL){
printf("\n\n");
while (linha_elim != NULL){
x=x+1;
if(x == num_linha){
for (x=0; x<COLUNA; x++)
{
if (linha_elim->coluna[x]!=' '){

hiperion@teddy:~$ mysql -u hiperion -p Enter password: ERROR 1045 (28000): Access denied for user 'hiperion'@'localhost' (using password: YES)

from scapy.all import *
capture = rdpcap(sys.argv[1])
for packet in capture:
if packet.haslayer(UDP) and packet.haslayer(IP) and packet.haslayer(Raw):
if packet.getlayer(Raw).load == sys.argv[2]:
start = packet.time
if packet.getlayer(Raw).load == sys.argv[3]:
end = packet.time
@diogomonica
diogomonica / bigfiles
Created January 7, 2011 14:41
Finds all files bigger than 20m in a linux system, presenting them from Biggest to smallest (including full path and actual size)
find / -type f -size +20000k -exec ls -lh {} \; 2> /dev/null | awk '{ print $NF ": " $5 }' | sort -nrk 2,2
@diogomonica
diogomonica / gist:822771
Created February 11, 2011 18:15
Log what files are being opened and accessed on a OSX
sudo fs_usage -w -f filesys mdworker | egrep "open"
@diogomonica
diogomonica / gist:822773
Created February 11, 2011 18:16
Disable/enable spotlight indexing in OS X
sudo mdutil -a -i off
sudo mdutil -a -i on
@diogomonica
diogomonica / gist:842627
Created February 24, 2011 18:35
Command line remote server heartbeat monitor!
while (true); do nc -vv -z -w3 <REMOTEIP> <REMOTEPORT> > /dev/null && echo -e "\x07"; sleep 1; done
require 'rubygems'
require 'nokogiri'
ATTRIBUTES = ['accelx', 'accely', 'accelz', 'altitude',
'depth', 'heading', 'lat', 'long', 'pitch',
'pitchrate', 'roll', 'rollrate', 'yawrate']
f = File.open(ARGV[0])
doc = Nokogiri::XML(f)
f.close
#! /bin/bash
url="http://rez.urbanspoon.com/b/widget/2086?background=ebf3fd&border=bbd4f1&header=000&link=0144a7&locale=en&source=selfhost&text=000"
hash=`cat /tmp/state_bird`
`curl $url | md5sum | awk '{print $1}' > /tmp/state_bird`
newhash=`cat /tmp/state_bird`
if [[ "$hash" != "$newhash" ]]; then echo "Reservations page just changed: http://statebirdsf.com/reservations/ - $newhash" | mail -s Reservations diogo.monica@gmail.com; fi
require 'rubygems'
require 'mechanize'
FIRST_NAME = 'FIRST_NAME'
LAST_NAME = 'LAST_NAME'
PHONE = 'PHONE'
EMAIL = 'EMAIL@provider.com'
PARTY_SIZE = 2
SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' }