August 25th, 2011
grep HOST= | perl -ne '/^(.*?)*/; print $1;
while (/((HOST=.*?))/g) { print "$1";}; print "n"; '
Tags: perl, regex
Posted in Uncategorized | Comments Off
June 23rd, 2011
curl -sk https://cmsweb.cern.ch/sitedb/reports/showXMLReport/?reportid=phedex_cmsname_map.ini |
grep cms_name | sed 's@<([^<>][^<>]*)>([^<>]*)@2@g' |
sed 's/^[ t]*//;s/[ t]*$//' | sort | uniq >> sites
Tags: curl, regex, sed, sitedb
Posted in Uncategorized | Comments Off
April 6th, 2011
curl -sk 'https://some.ulr/xml' | xmllint --format --recover -
Tags: curl, xml
Posted in Uncategorized | Comments Off
March 21st, 2011
pkgutil --pkgs | grep [some package]
pkgutil --unlink [your ID]
pkgutil --files [your ID]
pkgutil --forget [your ID]
Tags: Mac
Posted in Uncategorized | Comments Off
September 2nd, 2010
diskutil secureErase freespace 0 /Volumes/Disk1 > /var/log/secureeraselog.tmp
Usage: diskutil secureErase [freespace] level MountPoint|DiskIdentifier|DeviceNode
Securely erases either a whole-disk or a volume's freespace.
Level should be one of the following:
0 - Single-pass zeros.
1 - Single-pass random numbers.
2 - US DoD 7-pass secure erase.
3 - Gutmann algorithm 35-pass secure erase.
4 - US DoE 3-pass secure erase.
Ownership of the affected disk is required.
Note: Level 2, 3, or 4 secure erases can take an extremely long time.
Tags: Mac
Posted in Uncategorized | Comments Off
February 6th, 2010
ffmpeg -qscale 1 -r 8 -b 9600 -i w%d.png movie.avi
ffmpeg -sameq %04d.jpg output.mp4
Tags: avi, ffmpeg, mp4
Posted in Uncategorized | Comments Off
January 26th, 2010
#!/bin/bash
for ((a=1; a <= 429 ; a++))
do
echo $a
done
#!/bin/bash
counter=0
x=0
cat somefile | while read LINE
do
echo $LINE
let x=$x+1
echo $x
done
Tags: bash
Posted in Uncategorized | Comments Off
December 15th, 2009
awk '{ sum += $1; sumsq += $1*$1 } END { printf "Mean: %f, Std: %fn", sum/NR, sqrt(sumsq/NR-(sum/NR)^2) }' /tmp/bbb
#!/usr/bin/env perl
use strict;
use warnings;
use Math::NumberCruncher;
my @data;
open (IN, “<”, “$ARGV[0]“) or die (“Cannot open $ARGV[0]: $!n”);
while () {
push @data, $1 if (/(d+)/);
}
close (IN);
printf(“Mean: %ftMedian: %ftStdDev: %fn”,
Math::NumberCruncher::Mean(@data),
Math::NumberCruncher::Median(@data),
Math::NumberCruncher::StandardDeviation(@data));
Tags: awk, perl
Posted in Uncategorized | Comments Off
December 1st, 2009
rpm2cpio myrpmfile.rpm
rpm2cpio - < myrpmfile.rpm
rpm2cpio myrpmfile.rpm | cpio -idmv
Tags: rpm
Posted in Uncategorized | Comments Off
November 25th, 2009
#!/usr/bin/env perl
use strict;
use warnings;
use File::Path;
use File::Basename;
use LWP::Simple qw(get $ua);
use Data::Dumper;
foreach my $a (0 .. $#ARGV) {
# do some work $ARGV[$a];
}
Tags: perl
Posted in Uncategorized | Comments Off