Finding files newer than a certain date / time

October 11, 2011

Today I needed to find all files in a directory tree that had been updated since a specific point in time.

After a few trials this solution worked perfectly.

Create a file “touched” at the date you want to start from.

Then do a “find” that uses this file’s timestamp as a reference.

As simple as:

touch -t 201109130845 start-file.tmp
find messages/ -newer start-file.tmp


Rails 3 on debian with Sqlite 3

October 13, 2010

Decided to move to Rails 3 recently and get up to speed on the new framework version.

I list here the process I followed to install it on Debian (Lenny).

*Note, some of these commands need root / administrator privileges. Notably the apt and install commands. Use sudo, su or a root shell.

Install dependancies

# optional VCS, we use Mercurial Locally and Git for deployments to Heroku (hosting)

apt-get install git-core mercurial

# libmysqlclient15off libreadline5-dev
apt-get install build-essential libreadline5-dev libssl-dev zlib1g zlib1g-dev

#optional Database, I have detail for getting Sqlite3 later
#apt-get install mysql-common mysql-server

Install Ruby

wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p0.tar.gz
tar xzf ruby-1.9.2-p0.tar.gz
cd ruby-1.9.2-p0
./configure
make
make install

Install sqlite 3

wget http://www.sqlite.org/sqlite-amalgamation-3.7.2.tar.gz
tar xzf sqlite-amalgamation-3.7.2.tar.gz
cd sqlite-3.7.2/

./configure
make
make install

gem install rails sqlite3-ruby

Create your rails app

rails new Items
rails g scaffold Item name:string detail:text
rake db:migrate
rm public/index.html
vim config/routes.rb

add this line:

root :to => "items#index"

then start the server:

rails s

Open your browser and go to http://localhost:3000/

And that’s it!


Deploying your Rails 3 app to Heroku from Debian GNU/Linux

October 11, 2010

Deploying apps to Heroku is as simple as

git push heroku master

But you need a little bit of setup first.

If you haven’t got git, install it with

apt-get install git-core

You will also need the Heroku gem

gem install heroku

Then set up your app, adding the files to the git repository

cd myapp
git init
git add *
git commit -m 'first commit, using git for pushes to heroku which hosts rails apps free and uses git'

Create a key for secure authentication to Heroku

ssh-keygen -t rsa -C "me@mycompany.com"
heroku keys:add

Create your heroku app

heroku create

And push your new rails app to it

git push heroku master

Now browse to the url you were given in previous steps as feedback from heroku, and you should see your app, now live !


root user password recovery / resetting on Debian/GNU based linux systems

August 5, 2010

I have had need for this more often than I would like of late, it is a nice and quick way to reset the root password if you can’t remember, or the person who had it isn’t around any more. You need access to the actual console of course, physical access or a remote KVM. I’ve used this on both Debian boxes and Ubuntu boxes recently.

  1. rebooot the machine
  2. interrupt the boot sequence at the GRUB bootloader / LILO screen (I haven’t seen LILO on Deban / Ubuntu in quite a while)
  3. edit the boot line with “kernel” information (select and press e to edit)
  4. add init=/bin/bash to the end of the line
  5. hit enter and then press ‘b’ to boot
  6. when the boot sequence has finished, type the following:

mount -o remount,rw /
passwd root
(enter the new password for the ‘root’ user)
shutdown -r now (to reboot and login as root with the new password)


Debian : Apache : PHP : Database Error: Unable to connect to the database:The MySQL adapter “mysql” is not available.

May 28, 2010

Got this today when I browsed to my Joomla site, which I had just imported from elsewhere.

Database Error: Unable to connect to the database:The MySQL adapter "mysql" is not available.

Setting the correct database password in the joomla configuration file fixed the issue.


Sed and Print in Perl

February 15, 2010

I recently needed a sed-like script for a web based perl app doing to internally convert request ports and came across some interesting print code in the process of testing it

#!/usr/bin/perl

sub println
{
$\ = "\n";
@_ = ($_) unless @_;
print @_;
}

 

my $sec = "https://dmom.domain.com:633/confirm/me/";
$sec =~ s/:633/:81/;
println $sec;


VNC server : Fatal server error: could not open default font ‘fixed’

August 18, 2009

Trying to run vnc-server recently on a debian system, I ran into the following issue:

cat .vnc/debian-dev\:1.log
14/08/09 14:40:01 Xvnc version 3.3.7 - built Dec 30 2006 12:50:35
14/08/09 14:40:01 Copyright (C) 2002-2003 RealVNC Ltd.
14/08/09 14:40:01 Copyright (C) 1994-2000 AT&T Laboratories Cambridge.
14/08/09 14:40:01 All Rights Reserved.
14/08/09 14:40:01 See http://www.realvnc.com for information on VNC
14/08/09 14:40:01 Desktop name 'X' (debian-dev:1)
14/08/09 14:40:01 Protocol version supported 3.3
14/08/09 14:40:01 Listening for VNC connections on TCP port 5901
Font directory '/usr/share/fonts/truetype/' not found - ignoring

Fatal server error:
could not open default font 'fixed'

I solved the issue with some apt-get for dependancies as per below

apt-get install xutils xbase-clients xfonts-base xfonts-75dpi xfonts-100dpi

Ref:  http://www.debianhelp.org/node/5720


QuickSilver-esque shortcuts application on Ubuntu Debian GNU/Linux

October 6, 2008

Some of my colleagues have Apple Macs and use an application called ‘Quick Silver’ for managing frequently use application/scripts/text files/notes/ims/etc.

I was impressed with what one could do with it and began looking for something similar on Ubuntu.

There is a clone for Gnome called Gnome-Do [ http://www.gnomedo.com ] that lives up to the task pretty well from what I can gather so-far. There are some good updates in the ‘Intrepid Ibex’ release (8.10) that are not in the ‘Hardy Heron’ release (8.04), such as a more complete and useful preferences menu, more plugins and managing them individually through the applications preferences.

Try it out, after installing gnome-do, you need to set it up to launch at gnome login (easily done via the preferences in the intrepid version). Then you can invoke it with the SUPER+SPACEBAR short-cut.


Using MySql with Jahia on Debian GNU/Linux

October 6, 2008

After installing Jahia today, I wanted to use the MySql database instead of the default HyperSonic. I am currently using MySql for other purposes and want to have a look at accessing the Jahia database to re-use content.

Initially when I created the ‘jahia’ database in mysql and granted permissions to the Jahia user, Jahia reported:

"This database doesn't seem to support extended charsets."

Dropping the database and recreating it with a unicode dataset sorts this little niggle out.

mysql> create database jahia character set = utf8;


Creating labels for disks in Ubuntu Debian GNU/Linux

March 31, 2008

The ability to create or change the disk label of fat/fat32/vfat file systems/partitions doesn’t come with Parted; yet is quite simple to achieve with Ubuntu Debian GNU/Linux :) .

This comes in very handy when you have a number of fat devices (like USB, SD, etc) and want something more meaningful than just “disk” as its name.

Get mtools if you haven’t it already
sudo apt-get install mtools

Create a configuration file to avoid some error reporting
echo "mtools_skip_check=1" > ~/.mtoolsrc

Check where your disk is in the linux devices
mount

Label your disk
mlabel -i /dev/sdb1 -s ::my_disc

…and there you have it.

Disconnect the device and reconnect it and the label will show when it is auto mounted.


Follow

Get every new post delivered to your Inbox.