Rather than moving to the beginning of a line and the end of a line, ctrl-a and ctrl-b were just print ^A and ^B to the screen. Not sure why, I don't really have time to investigate, but this seems to fix the issue when run within the tmux session.
set -o emacs
Tuesday, 24 August 2010
Wednesday, 18 August 2010
MySQL Grants grant and revoke
I'm not really a fan of MySQL but here is a simple problem I always forget the syntax for which is really a SQL issue.
An installation of MediaWiki has an update script which requires the DROP privilege on the database, so I wanted to add the DROP privilege, run the update script and revoke the DROP privilege again.
Here's how:
mysql> show grants for 'username'@'host';
mysql> grant drop on adatabase.* to 'username'@'host';
mysql> revoke drop on adatabase.* from 'username'@'host';
Job's a good-un!
An installation of MediaWiki has an update script which requires the DROP privilege on the database, so I wanted to add the DROP privilege, run the update script and revoke the DROP privilege again.
Here's how:
mysql> show grants for 'username'@'host';
mysql> grant drop on adatabase.* to 'username'@'host';
mysql> revoke drop on adatabase.* from 'username'@'host';
Job's a good-un!
Tuesday, 20 July 2010
Simple SSH Tunneling
Today I had a problem where the office firewall would not let out traffic to the fibs.com server on port 4321 (Shame on them!)
Luckerly a remote machine comes in handy. I then just tell my Fibs client to connect on localhost port 4444
ssh -f -L 4444:fibs.com:4321 aremotemachine -N
Luckerly a remote machine comes in handy. I then just tell my Fibs client to connect on localhost port 4444
ssh -f -L 4444:fibs.com:4321 aremotemachine -N
Wednesday, 17 March 2010
In-place file editing with sed
This took me a while to work out why this would not work. When using the -i option with sed you need to specify a backup extension to be used (at least on my 10.5 mac you do!)
e.g.
sed -i '' -e 's/something/something else/g' -e 's/again/again again/g' *.py
e.g.
sed -i '' -e 's/something/something else/g' -e 's/again/again again/g' *.py
Monday, 4 January 2010
Nested List Comprehension
I never really feel like i'm any good at using Python unless I am doing cool things with List Comprehension.
Here's a quick example of nested list comprehension I used today to create a new list from a list containing lists of three items
Visually:-
[['mostly cloudy (day)', 'cloudy3.png', 'cloudy3.png'],
['partly cloudy (night)', 'cloudy2_night.png', 'cloudy2_night.png'],
['partly cloudy (day)', 'cloudy2.png', 'cloudy2.png'],
....................................
['Sunny', 'sunny.png', 'sunny.png']]
To this:-
[['mostly cloudy (night)', 'cloudy3_night.png'],
['mostly cloudy (day)', 'cloudy3.png'],
['partly cloudy (night)', 'cloudy2_night.png'],
....................................
['Sunny', 'sunny.png']]
The code then:-
[[a[0],a[1]] for a in theList]
Here's a quick example of nested list comprehension I used today to create a new list from a list containing lists of three items
Visually:-
[['mostly cloudy (day)', 'cloudy3.png', 'cloudy3.png'],
['partly cloudy (night)', 'cloudy2_night.png', 'cloudy2_night.png'],
['partly cloudy (day)', 'cloudy2.png', 'cloudy2.png'],
....................................
['Sunny', 'sunny.png', 'sunny.png']]
To this:-
[['mostly cloudy (night)', 'cloudy3_night.png'],
['mostly cloudy (day)', 'cloudy3.png'],
['partly cloudy (night)', 'cloudy2_night.png'],
....................................
['Sunny', 'sunny.png']]
The code then:-
[[a[0],a[1]] for a in theList]
Friday, 4 December 2009
Sharing media for Xbox360 on Linux/Mac
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
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
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.
Subscribe to:
Posts (Atom)