gem list
rails (3.0.5,2.3.11)
rails -v
Rails 3.0.5
#Create a rails project with version 2.3.11
rails _2.3.11_ MyProject
Friday, May 6, 2011
Monday, February 7, 2011
MySql dump with Cronjob
0 0 * * 0 /usr/bin/mysqldump -uroot -p'PASS' DBName > /path/DB_backup/$(date +\%Y-\%m-\%d_\%Hh\%M).sql
example output file:
2011-02-06_00h00.sql
example output file:
2011-02-06_00h00.sql
Wednesday, September 15, 2010
Sym Link to multiple CIFS mounts
A simple script that creates sym links to multiple cifs mounts and dumps them into a master folder.
#!/bin/bash
DIR="/media/MDrive/"
DIR2="/media/ZDrive/"
DIR3="$DIR $DIR2"
DIR4="masterDownloads"
#echo $DIR3
IFS=$'\n'
#for i in $(find $DIR -type f -printf "%f\n")
for i in $(find $DIR -type f)
do
echo "Processing... $i"
mkdir -p ./$DIR4/$(dirname $i)
ln -s $i ./$DIR4$i
clear
done
Thursday, July 22, 2010
Wednesday, July 7, 2010
data integrity check from CSV
To test the data integrity in your CSV file and locate any lines that contain the delimiter in the data field so that it can be removed manually.
Regular Expression:
/(?:.*?\|){4,}.*/
Will select lines that contain 4 or more pipes per line.
(?: ) is a non-capturing group. Similar to ( ), except that it doesn't store the result for later reference.
A more greedy approach is to write something like this:
/^(?:[^|]*\|){4}[^|]*$/
This will match lines that contain only four pipes
Test it:
http://rubular.com/r/f7Vd9O1c4k
Or using ruby one-liners:
#print only lines that match a regular expression (emulates 'grep')
$ ruby -pe 'next unless $_ =~ /regexp/' < file.txt
#print only lines that DO NOT match a regular expression (emulates 'grep')
$ ruby -pe 'next if $_ =~ /regexp/' < file.txt
Regular Expression:
/(?:.*?\|){4,}.*/
Will select lines that contain 4 or more pipes per line.
(?: ) is a non-capturing group. Similar to ( ), except that it doesn't store the result for later reference.
A more greedy approach is to write something like this:
/^(?:[^|]*\|){4}[^|]*$/
This will match lines that contain only four pipes
Test it:
http://rubular.com/r/f7Vd9O1c4k
Or using ruby one-liners:
#print only lines that match a regular expression (emulates 'grep')
$ ruby -pe 'next unless $_ =~ /regexp/' < file.txt
#print only lines that DO NOT match a regular expression (emulates 'grep')
$ ruby -pe 'next if $_ =~ /regexp/' < file.txt
Subscribe to:
Posts (Atom)