The every day things from Thalamus' life.

Thalamus' Blog

29 June, 2010

Uninstalling a bunch of packages … that I installed by misstake.

Filed under: ComputerStuff_en — Thalamus @ 10:29

Today I installed some packages that I didn’t really need – I decided to almost immediatly uninstall them again. So, a combination of different unix commands made it all easy. I could have used ‘awk’ – but, there was some packages that where named 1:xxxx.rpm, others 2:xxx.rpm etc. So, instead I fell back to old trusty perl.

grep "Jun 29" /var/log/yum.log | perl -e 'while(<>) {chomp;$_=~s/.*:{1,2}//;print " $_";}' | xargs rpm -e
• • •
 

23 June, 2010

Cisco VPN start/stop script

Filed under: ComputerStuff_en — Thalamus @ 23:20

Today I needed the VPN tunnel to my work again … but, darn – I forgot that I had just upgraded the kernel so I had to compile it once again. Thought I was finished when I noticed that it kept freezing up – googled and found that the reason was that the client don’t really support smp (more than one core). This seems to happen only then and now – so, the solution was to just diable one of the cores. But – would I remember this for the future ? Probably not – so I made a small script that I’m putting out there for everyone to use if they want. It is meant to be run as root – but ofc can be modified to use ‘sudo’ or whatever you need it to.

  1.  
  2. #!/bin/bash
  3. #
  4. # Startup script for Cisco VPN
  5. # Author: xxx@gmail.com
  6. #
  7.  
  8. PROFILE=Profilename
  9.  
  10. start()
  11. {
  12.         echo -"Starting VPN kernel module:"
  13.         /etc/init.d/vpnclient_init start
  14.         echo -n "Username : "
  15.         read USERNAME
  16.         echo -n "Password : "
  17.         stty_orig=`stty -g`
  18. 	stty -echo
  19. 	read PASSWORD
  20. 	stty $stty_orig
  21.         echo "Disabeling CPU #2 (Cisco Bug) & sleeping 3 seconds"
  22.         echo 0 > /sys/devices/system/cpu/cpu1/online
  23.         sleep 3
  24.         echo "Starting the VPN Tunnel"
  25.         vpnclient connect $PROFILE user $USERNAME pwd $PASSWORD &
  26. }
  27. stop()
  28. {
  29.         echo "Terminating the VPN Tunnel"
  30.         vpnclient disconnect
  31.         echo "Re-enabeling CPU #2 (Cisco Bug, previously disabled)"
  32.         echo 1 > /sys/devices/system/cpu/cpu1/online
  33.         echo "Stopping VPN kernel module:"
  34.         /etc/init.d/vpnclient_init stop
  35. }
  36.  
  37. case "$1" in
  38.         start)
  39.                 start
  40.                 ;;
  41.         stop)
  42.                 stop
  43.                 ;;
  44.         *)
  45.                 echo $"Usage: $0 {start|stop]"
  46.                 exit 3
  47.                 ;;
  48. esac
• • •
 

17 June, 2010

Upside down – Internet

Filed under: ComputerStuff_en — Thalamus @ 20:48

On several occasions I’ve came across this link – explaining how you can mess with your neighbour ‘stealing’ your unencrypted wifi. I just love the way this brain is wired … how did you come up with this great idea ?! šŸ™‚

http://www.ex-parrot.com/peter/upside-down-ternet.html

My wifi is secure – but, I run dhcp and from time to time I do have friends visiting me – loaning my wifi. What if I logged on .. did a quick check of their lease and simply the preroute on them ? šŸ™‚

/sbin/iptables -A PREROUTING -s xxx.xxx.xxx.xxx/32 -p tcp -j DNAT --to-destination 64.111.96.38

… or some other fun site šŸ™‚

Thanks Peter – for this great idea. I will some day … put it into use 4 fun.

• • •
 

16 June, 2010

Teamspeak 3 – server query

Filed under: ComputerStuff_en — Thalamus @ 00:48

Today I descided to pick up again the teamspeak 3 server query client I made last week. It was full of comments, unstructured code and last but not least – not complete for my purpose. I started editing it mostly because I descided to try out the eclipse editor with perl plugin support. Once I fired that one up – I suddenly realized that I needed some code to edit šŸ™‚

So, the perfect thing was obviously the previous incomplete gibberish I had laying around. I must say. Eclipse might become my favourite editor in the near future. Time will tell I guess.

If you want to try out the result – head over to http://thalamus.no-ip.com/cgi-bin/ts3query.cgi – it doesn’t look impressive … I know. But, the code has alot of things in place in order to extend its functionality only with adding a few lines of code. If someone would want to have a copy of it … please don’t hesitate to ask.

Oh – and since I’m editing … here is my current PS1 variable for the bash prompt.

export PS1="\[\e[0;32m\]\u\[\e[m\]\[\e[1;31m\]@\[\e[m\]\[\e[1;33m\]\h\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$ \[\e[m\]\[\e[0;37m\]"
• • •