8

How To View A Specific SVN Revision In Your Browser


Posted by Artem Russakovskii on February 20th, 2010 in SVN, Tips

Updated: July 26th, 2010

image This is a quick recipe that I found pretty interesting and relatively unknown.

Everyone who uses SVN knows that most repositories are set up to allow viewing of their contents via a web browser. For example, here's the trunk of WP Plugins SVN: http://plugins.svn.wordpress.org/ and here is the current trunk version of a specific file, let's say http://plugins.svn.wordpress.org/stats/trunk/readme.txt.

The Problem

However, what if you wanted to view a specific revision of a file or directory in your browser?

Let's say I wanted revision 100,000 of http://plugins.svn.wordpress.org/stats/trunk/readme.txt

Normally, on a command line, you'd do something like

svn co http://plugins.svn.wordpress.org/stats/trunk/readme.txt stats
cd stats;
svn up -r100000 readme.txt

or simply

2

[Perl] Finding Files, The Fun And Elegant Way


Posted by Artem Russakovskii on April 8th, 2009 in Awesomeness, Linux, Perl, Programming, Tutorials

Updated: October 6th, 2009

No matter what programming language you use, there comes a time when you need to search for a file somewhere on the file system. Here, I want to talk about accomplishing this task in Perl. There are many ways of doing so, most of them boring, but I want to discuss the fun and elegant way – using File::Find::Rule.

Let me briefly discuss some of the other methods first.

Limited

Using glob() (or <>, TODO verify) you can find files in a single directory, using only the limited shell wildcard support. For example,

1
my @files = glob(&quot;tmp*&quot;);
I prefer glob() to <> because glob()'s parameters can be more than just

Read the rest of this article »

8

How To List Files Within tgz (tar.gz) Archives


Posted by Artem Russakovskii on April 26th, 2008 in Linux

This may not be very obvious but this is the command line to list files within a tar.gz archive on the fly:

1
tar -tzf file.tar.gz

-t: lists files
-f: instructs tar to deal with the following filename (file.tar.gz)
-z: informs tar that the it's dealing with a gzip file (-j if it's bzip2)…

Read the rest of this article »

2

Quick Perl Snippet: Finding If A File Has A Media Extension Using Regex


Posted by Artem Russakovskii on March 21st, 2008 in Programming

Updated: May 1st, 2008

Sometimes in my line of work, I need to figure out if a url or filename point to a media file by checking for the file extension. If it's a url, however, it may be followed by various parameters. Not to overcomplicate things, I came up with the following Perl code:

1
2
3
4
5
6
7
8
9
10
#!/usr/bin/perl -w
use strict;
my $name = "some_file.flv"; # or http://example.com/file.mp4?foo=bar
my $is_media_type = ($name =~ /\.(wmv|avi|flv|mov|mkv|mp..?|swf|ra.?|rm|as.|m4[av]|smi.?)\b/i);
if($is_media_type){
  print "media extension found\n";
}
else{
  print "not a media file\n";
}

Read the rest of this article »