## Listing directories only in linux

Posted: 9th February 2015 by Tim in Linux
Tags: , , , , , ,

The ls command will list files and directories in the current directory. But what if you only want to list the directories? There are a few ways to do this. One of the easiest ways is this: ls -d */ The -d flag instructs ls to display directories instead of displaying directory contents. The */ […]

## Find the current working directory of a process in Linux

Posted: 28th May 2014 by Tim in Linux
Tags: , , , , , , , , ,

Using tools such as ps or top, you are able to see the processes running on a machine. However, you can’t see the directory from which the process was started. Knowing the working directory can be useful if, for example, you need to move a script or program to stop a fork bomb, if you […]

## Randomizing (shuffling) a List in Java

Posted: 11th February 2012 by Tim in Java
Tags: , , , , , , ,

If you need to randomize or shuffle a List in Java (ArrayList, LinkedList, etc) you can do this with the Collections.shuffle(<list>) function. This is a static function which works on all List types. For example: import java.util.ArrayList; import java.util.Collections; … ArrayList<Integer> myList = new ArrayList<Integer>(); for (int x = 0; x < 10; ++x) { […]

## Min and max functions in Perl

Posted: 1st February 2012 by Tim in Perl
Tags: , , , , ,

Min and max functions are available in perl, but you need to load them first. To do this, add use List::Util qw[min max]; to the top of the script. These functions take a list of numbers and return the min/max of that list. The list can have 1 number or 100 – it doesn’t matter: […]

## Definition list in LaTeX

Posted: 14th June 2011 by Tim in LaTeX
Tags: , , , , , , , ,

If you want to include a glossary, definitions or some other descriptive list in your LaTeX document, you can make use of the description list type. This is a lot like the other list types except that \item can take an argument, the item `name’, in square brackets (ie: \item[Tim Murphy] Author of http://timmurphy.org). In […]

## Changing itemize bullet styles in LaTeX

Posted: 5th July 2010 by Tim in LaTeX
Tags: , , , , , , , , , , , ,

Latex allows the creation of itemized (unordered) lists up to four deep. The numbering styles for each depth can be styled to suit your needs using the \renewcommand{label}{style} command, where label is the list depth being styled and style is how you want that number to be shown. label may be any of the following: […]

## Changing enumerate number styles in LaTeX

Posted: 2nd July 2010 by Tim in LaTeX
Tags: , , , , , , , , ,

Latex allows the creation of enumerated (ordered) lists up to four deep. The numbering styles for each depth can be styled to suit your needs using the \renewcommand{label}{style} command, where label is the list depth being styled and style is how you want that number to be shown. label may be any of the following: […]