Delete Trac Tables
2009
for i in `sqlite3 trac.db '.tables'`; do sqlite3 trac.db "delete from $i"; done
my web space
for i in `sqlite3 trac.db '.tables'`; do sqlite3 trac.db "delete from $i"; done
sample HTML file
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en">
<head>
<script src="jquery.min.js" type="text/javascript"></script>
</head>
<body>
<div id="container"></div>
<script src="gen.html.js" type="text/javascript"></script>
</body>
</html>sample JavaScript file (should be named gen.html.js)
$("#container").css({margin:"5% auto 5% auto",width:"70%",'max-width':"70%"}); $("#container").append("<div id='header'>this is the header</div>"); $("#container").append("<div id='body'>this is the body</div>"); $("#container").append("<div id='footer'>this is the footer</div>"); $("#header").css({width:"100%",height:"33px",'padding-top':"10px",'text-align':"center",border:"1px solid #777",background:"#ddd"}); $("#header").after("<div style='clear:both'>&&</div>"); $("#body").css({width:"100%",height:"50%",'madrgin-top':"2%",border:"1px solid #777",background:"#eee"}); $("#body").after("<div style='clear:both'> </div>"); $("#footer").css({width:"100%",height:"33px",'padding-top':"10px",'text-align':"center",border:"1px solid #777",background:"#ddd"}); $("#body").append("<p>1. sub body</p>"); $("#body").append("<p>2. sub body</p>"); $("#body p:first").css("text-decoration", "underline"); $("#body p:last").css("text-decoration", "overline");
# sort by user id ruby -a -F: -ne 'puts $F.values_at(2, 0).join("\t")' '/etc/passwd' | sort -g # sort by user home directory ruby -a -F: -ne 'puts $F.values_at(5, 0).join("\t")' '/etc/passwd' | sort -g # sort by username ruby -a -F: -ne 'puts $F.values_at(0).join("\t")' '/etc/passwd' | sort -g
Symptoms: one green light flash, followed by two green ones.
Conclusion: the player is dead.
Remedy: download ipod reset utility, reset the player and
# change _path_to_the_device_ with the real path (see `dmesg|tail`) mount /dev/_path_to_the_device_ /mnt && cd /mnt # download rebuild_db.py from http://shuffle-db.sourceforge.net/ # copy 'rebuild_db.py' in /mnt and create the dirs' structure python -c ' import os os.makedirs("iPod_Control/iTunes") os.makedirs("Music") ' cd /mnt && cp ~/Music/*.mp3 Music python rebuild_db.py cd .. && umount
That’s it.
P.S. you can format an ipod device as many times as you like,
just follow the above procedure to reset it.
I wasn’t able to download a photo from flickr. It happened to be 1px transparent image over the other. Here is a simple scaper in cases of such “protection”:
1 2 3 4 5 6 7 8 9 10 11 12 | require 'rubygems' require 'www/mechanize' url = 'http://www.flickr.com/photos/46457493@N00/3162339409/in/set-72157612102050814/' my_id = url.split("/")[-3] agent = WWW::Mechanize.new page = agent.get(url) url = page.search("//div[@id='photoImgDiv#{my_id}']/img").attr('src') agent.get(url).save_as((File.basename(url)).split("?")[0]) |
This iptables config will block all incoming traffic, except from machines, identified by thier MAC addresses:
iptables -F INPUT
iptables -A INPUT -m mac—mac-source 00:3f:5f:ab:2c:7d -j ACCEPT
iptables -A INPUT -m mac—mac-source 00:1e:32:36:97:4a -j ACCEPT
iptables -A INPUT -m mac—mac-source 00:44:11:a5:1d:6d -j ACCEPT
# or by ip address:
#iptables -A INPUT -p tcp -s 1.1.1.1 -j ACCEPT
#iptables -A INPUT -p tcp -s 2.2.2.2 -j ACCEPT
#iptables -A INPUT -p tcp -s 3.3.3.3 -j ACCEPT
iptables -A INPUT -m state—state ESTABLISHED -j ACCEPT
iptables -A INPUT -s 127.0.0.1 -j ACCEPT
iptables -A INPUT -j REJECT
I like to see green prompt for userid > 0 and red for root, also the hostname and the history number of a command.
PS1="\[\e[32;1m\]\u\[\e[30;1m\]@\[\e[32;1m\]\H[\!]\W\[\e[30;1m\]\\$\[\e[0m\]"
PS1="\[\e[32;1m\]\u\[\e[30;1m\]@\[\e[32;1m\]\H[\!]\W\[\e[30;1m\]\\$\[\e[0m\]"
tail -f production.log | egrep "([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}"
#!/usr/bin/perl $s = shift; $" = "\n"; $/ = $\; $_ = <data>; @_ = /(.*?$s.*)/gi; print "@_\n"; __DATA__ me "some address" my_phone_here etc... etc...</data>
#!/usr/bin/ruby host_port = ARGV[0] host = host_port.split(':').first port = host_port.split(':').last puts %x[nmap -p #{port} #{host}]
Or just:
#!/usr/bin/ruby puts %x[nmap -p #{ARGV[0].split(':').reverse.join(' ')}]
Usage (cli and given that the script is named scan_proxy):
./scan_proxy 202.105.182.87:808