Ok, so you can't use samba with Xbox360 and there is no-way I am gonna use Windows. Luckerly, after some dedicated google-ing I came across 2 solutions, both of which did work, but at present the uShare seems to be the tidiest.
http://netou.co.uk/?p=28 Tested on SuSE Linux 11.1
http://ubuntuforums.org/showthread.php?t=848144
http://code.google.com/p/ps3mediaserver/ Tested on Mac 10.5.8 PPC and SuSE Linux 11.1
Friday, 4 December 2009
Tuesday, 10 November 2009
Xbox Live firewall Rules
A google for xbox live firewall ports never gave me specific ports requirements so here they are as I have discovered them.
Inbound. (A Nat based router/firewall these will need direct port forwarding. On my Juniper I set up a VIP.)
88 UDP
3074 UDP
3074 TCP
Outbound (I locked the DNS lookups to my DNS servers only)
53 UDP (DNS)
53 TCP (DNS)
88 UDP
3074 UPD
80 TCP
443 TCP - This was not mentioned on the net but traffic was trying to get through this port.
Sunday, 11 October 2009
A Question Of Python Style
Having ended up almost solely with Python at the end of a journey of many languages I have learnt and used; style has been something important to me.
Python has pep8 which states somethings definitively such as:-
* Use 4 spaces per indentation level" (I was actually using 2 until now!)
* Limit all lines to a maximum of 79 characters.
* Separate top-level function and class definitions with two blank lines.
* Method definitions inside a class are separated by a single blank line.
...so things like naming styles are purely at the discretion of the user. Fair enough but i like to be consistent where I can with these things, and coming from a Java background I pretty much stick with a style I picked up from there. Here's some explaination. Things always seemed very well defined in the land of Sun!
http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367
http://geosoft.no/development/javastyle.html
...and so
* a class is ClassName()
* method names are lookBehindYou()
* class attributes are as above
this one from the geosoft link above I like also
* "Abbreviations and acronyms should not be uppercase when used as name.
exportHtmlSource(); // NOT: exportHTMLSource();
openDvdPlayer(); // NOT: openDVDPlayer();"
I've not mentioned doc strings here, the use of pep8 tool, pylint or pyflakes or even given an example class, well I guess that's the beauty of blogging!
This is worth knowing though http://wiki.laptop.org/go/Python_Style_Guide oooh and removing trailing whitespace in vim... thats :%s/\s\+$//
Python has pep8 which states somethings definitively such as:-
* Use 4 spaces per indentation level" (I was actually using 2 until now!)
* Limit all lines to a maximum of 79 characters.
* Separate top-level function and class definitions with two blank lines.
* Method definitions inside a class are separated by a single blank line.
...so things like naming styles are purely at the discretion of the user. Fair enough but i like to be consistent where I can with these things, and coming from a Java background I pretty much stick with a style I picked up from there. Here's some explaination. Things always seemed very well defined in the land of Sun!
http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367
http://geosoft.no/development/javastyle.html
...and so
* a class is ClassName()
* method names are lookBehindYou()
* class attributes are as above
this one from the geosoft link above I like also
* "Abbreviations and acronyms should not be uppercase when used as name.
exportHtmlSource(); // NOT: exportHTMLSource();
openDvdPlayer(); // NOT: openDVDPlayer();"
I've not mentioned doc strings here, the use of pep8 tool, pylint or pyflakes or even given an example class, well I guess that's the beauty of blogging!
This is worth knowing though http://wiki.laptop.org/go/Python_Style_Guide oooh and removing trailing whitespace in vim... thats :%s/\s\+$//
Tuesday, 29 September 2009
Python function args
I rarely use anything beyond named parameters, but this post captures what you need to know.
http://kbyanc.blogspot.com/2007/07/python-aggregating-function-arguments.html
http://kbyanc.blogspot.com/2007/07/python-aggregating-function-arguments.html
Wednesday, 23 September 2009
Formatting Output from MySQL prompt
I'm not the biggest fan of MySQL and on the occasions I do use it I always forgot how to get useful results from my queries. To get results paged to less and have them display vertically, you can do this
mysql> \P less
PAGER set to 'less'
mysql> select * from blahblah \G
mysql> \P less
PAGER set to 'less'
mysql> select * from blahblah \G
Restore Mysql Database from the .frm .MYI and .MYD files
OK so you have a mysql database that you have recovered from a backup. However, whereas you would normally have a nice sql dump to deal with, on this occasion you only have the .frm .MYI and .MYD files. Can you rescue that table the client has deleted? Indeed you can!
#> cd [where you databases are kept, possibly /var/lib/mysql ]
#> mkdir [name of database to rescue]
copy the .frm .MYI and .MYD files into it.
make sure the permissions are ok. Something like this
#> chown -R mysql:mysql [dbname]
#> chmod -R 700 [dbname]
Now if you are lucky, you should be able to do this:-
#> mysql -u root databasename -e "SHOW TABLES;";
#> mysqldump -u root databasename tablename
#> cd [where you databases are kept, possibly /var/lib/mysql ]
#> mkdir [name of database to rescue]
copy the .frm .MYI and .MYD files into it.
make sure the permissions are ok. Something like this
#> chown -R mysql:mysql [dbname]
#> chmod -R 700 [dbname]
Now if you are lucky, you should be able to do this:-
#> mysql -u root databasename -e "SHOW TABLES;";
#> mysqldump -u root databasename tablename
Monday, 21 September 2009
Essential HPing3 and TCPDump
HPing3
# Send 2 syn packets to port 80 on a host
hping3 -c 2 -S -p 80 example.com
# scan a some specfic ports on host
sudo hping3 -S example.com --scan 143,220,993,25,80
TCPDump
# capture packets on -ivenet0 interface, don't resolve addresses or port name (-nn) don't capture ssh traffic
tcpdump -ivenet0 -nn not tcp port 22
# the same as above but don't print minimal information (useful as a quick guide to see whats going over the wire)
tcpdump -ivenet0 -nn -q not tcp port 22
# specify a port and destination
tcpdump -ieth0 tcp port 443 and dst example.com
# capture all payload (-s0) and print it in ASCII format (-v -A)
tcpdump -ivenet0 -s0 -nn -v -A not tcp port 22
# dump all packets and payload to file
tcpdump -s0 -ieth0 port 80 -w localhostdump.pcap
# Send 2 syn packets to port 80 on a host
hping3 -c 2 -S -p 80 example.com
# scan a some specfic ports on host
sudo hping3 -S example.com --scan 143,220,993,25,80
TCPDump
# capture packets on -ivenet0 interface, don't resolve addresses or port name (-nn) don't capture ssh traffic
tcpdump -ivenet0 -nn not tcp port 22
# the same as above but don't print minimal information (useful as a quick guide to see whats going over the wire)
tcpdump -ivenet0 -nn -q not tcp port 22
# specify a port and destination
tcpdump -ieth0 tcp port 443 and dst example.com
# capture all payload (-s0) and print it in ASCII format (-v -A)
tcpdump -ivenet0 -s0 -nn -v -A not tcp port 22
# dump all packets and payload to file
tcpdump -s0 -ieth0 port 80 -w localhostdump.pcap
Setting-up Pylons in 5 mins
Really just a recap of http://pylonshq.com/docs/en/0.9.7/gettingstarted/#installing
Here we go
#> wget http://www.pylonshq.com/download/0.9.7/go-pylons.py
#> python2.6 go-pylons.py mydevenv
Everytime we work on a virtual pylons installation run the following script
#> source mydevenv/bin/activate
Create a new project
#> paster create -t pylons helloworld
Create a controller
#> paster controller hello
Fireup the webserver on localhost:5000
#> paster serve --reload development.ini
Here we go
#> wget http://www.pylonshq.com/download/0.9.7/go-pylons.py
#> python2.6 go-pylons.py mydevenv
Everytime we work on a virtual pylons installation run the following script
#> source mydevenv/bin/activate
Create a new project
#> paster create -t pylons helloworld
Create a controller
#> paster controller hello
Fireup the webserver on localhost:5000
#> paster serve --reload development.ini
Building Python from Source
How easy it is to install python from source? Very.
./configure --prefix=/usr/local/python2.6/
make (took 4mins on my x86_64 dc)
make install
./configure --prefix=/usr/local/python2.6/
make (took 4mins on my x86_64 dc)
make install
Subscribe to:
Posts (Atom)