Install/Update Webmin

Posted on March 31st, 2008 in Coding, Tools, Work by abdallah

I’ve always liked one-liners. Here’s one (almost) for installing the latest webmin on almost any linux out there!

[ bash Code ]
  1. #!/bin/bash
  2. EXT=".rpm"
  3. PMAN="rpm -U"
  4. if [ -e /etc/debian_version ]; then
  5. EXT=".deb"; PMAN="dpkg -i"
  6. fi
  7. wget http://webmin.com -O - | grep $EXT | grep -o ‘http://[^"]*’ | xargs wget -O webmin_latest$EXT; $PMAN webmin_latest$EXT

You could copy and past the above in a terminal session, or the following:
wget http://mt.trickos.com/dev/installwebmin.sh; sh installwebmin.sh

my dev ide

Posted on March 14th, 2008 in Coding, Work by abdallah

OK, so what else would one need from an IDE. It’s all there in a simple script. Here’s my django IDE :)

[ bash Code ]
  1.  
  2. gnome-terminal \
  3.         –hide-menubar \
  4.         –tab-with-profile=dev –working-directory=/home/abdallah/Projects/ -e "python manage.py runserver" -t "server" \
  5.         –tab-with-profile=dev –working-directory=/home/abdallah/Projects/ -e "python manage.py shell" -t "python shell" \
  6.         –tab-with-profile=dev –working-directory=/home/abdallah/Projects/ -t "my editor" \
  7.         –tab-with-profile=dev –working-directory=/home/abdallah/Projects/ -t ‘my shell’
  8. firefox http://localhost:8000/admin/ &
  9. firefox http://www.djangobook.com/en/ &
  10.  

Whassup

Posted on June 26th, 2007 in Blogging, Mood, Work by abdallah

Plenty, No time to blog about it though!
I started this entry at my place yesterday night, right after I was able to connect to the internet using the local isp’s crappy PPPoE installation.
For some reason, they are using the Service Name directive as an added means of user management! I have one word to say about this: pfff! To get this to work, I first tried installing via apt-get on the laptop (running ubuntu feisty). But that didn’t work, or at least I couldn’t connect. Next, I tried getting some other software but there was nothing else. So I grabbed the source tarball, and there you are, two minutes later I was connected [(sudo) tkpppoe being the keyword.]
tkpppoe

I am sleeping at my apartment these couple of days before the wedding. I like to get the feeling of the place before moving in: how much it takes to get to work (18mins leaving at 07:42!), how much sunlight I get in the morning in each room, where to get breakfast, the shower, etc…

What else, I started working remotely with some very nice people at RimuHosting. Not only are they really nice, they are truly very professional and very knowledgeable. I’m refining my Linux and hosting knowledge there. Moodeef is being re-worked as well, and I’m creating Flake file-service as a java/tomcat app. Hopefully it would be finished soon.

I’m not watching any movies or TV lately, I found the director’s cut (or studio cut) of David Lynch’s Dune (Frank Herbert’s) and I have it on my laptop, but I haven’t gotten to watching it yet!

I’d better get back to work now ;)

Postfix Jam

Posted on June 5th, 2007 in Work by abdallah

I got a call earlier today that some scripts are not sending mail to the users on my intranet. After doing some automated tests (yeah, I got that far last time I was writing a web-app!), I realized there was no problems with my code. Next was the mail server. I run postfix, over Mandriva, so I wasn’t expecting problems. However, I had a few!

First: mailq showed about 30 messages held.
Second: postqueue -f didn’t clear any of the messages.
Third: tail -f /var/log/mail/errors showed plenty of fatal: unknown service: smtp/tcp
Visiting the postfix FAQ was next:

Your Postfix /etc/postfix/master.cf file specifies that the Postfix SMTP client runs inside a chroot environment. However, the files necessary for that mode of operation are not installed below /var/spool/postfix.

True enough, the /var/spool/postfix/etc was gone all together!
This is an internal server, and I’m still looking for the culprit. But for the fix:
/usr/sbin/postfix-chroot.sh disable
it will print out a few lines saying it’s disabling chroot. Again:
/usr/sbin/postfix-chroot.sh enable
And the needed files for setting the chroot environment for postfix are in place.

Mandriva is still one of my favorite distros, no matter what you say.

Delete Old Files (bash)

Posted on May 7th, 2007 in Coding, Work by abdallah

find /path/to/dir -mtime +15 -delete

It’s a quick and easy solution in Linux. The one liner above would delete all the files in /path/to/dir that are older than 15 days!

Unix is user-friendly. It’s just very selective about who its friends are

More Cleaning

Posted on March 5th, 2007 in Coding, Work by abdallah

I was having trouble teaching people how to use the CLI version of the temp directory cleanup code (posted earlier). So, I cooked up this small VB app. Hope you like it.

CleanUp! Screenshot

If you need the code, I’ll attach it to this post later on. files added, enjoy

Delete Old Files (dotNet)

Posted on March 2nd, 2007 in Coding, Work by abdallah

Umm, I needed some way to clean up the files on my Win2K* servers. So here’s a quickie in VB.NET, hope it helps.

[ vb Code ]
  1.  
  2. ‘ Written by Abdallah Deeb on 02-Mar-2007
  3. ‘ Use at your own risk, I am not liable for any damages or lost files if you use this code.
  4. Imports System
  5. Imports System.IO
  6. Module DeleteOld
  7.  
  8.     Sub Main()
  9.         Dim sr As StreamReader
  10.         Dim folderName As String
  11.         Dim files As System.Collections.ObjectModel.ReadOnlyCollection(Of String)
  12.         Dim fileName As String
  13.         Dim fInfo As System.IO.FileInfo
  14.         Dim fCreation As Date
  15.         Dim cfgLine As String()
  16.         Dim numberOfDays As Integer
  17.  
  18.         sr = New StreamReader("c:\DeleteOld.cfg")
  19.         Do
  20.             cfgLine = Split(sr.ReadLine(), "|", 2)
  21.             folderName = cfgLine(0)
  22.             numberOfDays = Int(cfgLine(1))
  23.             files = My.Computer.FileSystem.GetFiles(folderName, _
  24.                         FileIO.SearchOption.SearchAllSubDirectories)
  25.             For Each fileName In files
  26.                 fInfo = My.Computer.FileSystem.GetFileInfo(fileName)
  27.                 fCreation = fInfo.CreationTime
  28.                 If DateDiff(DateInterval.Day, fCreation, Now()) > numberOfDays Then
  29.                     My.Computer.FileSystem.DeleteFile(fileName)
  30.                 End If
  31.             Next
  32.  
  33.         Loop Until folderName Is Nothing
  34.         sr.Close()
  35.  
  36.     End Sub
  37.  
  38. End Module