Profile
Achievement
deepsoul's Recent Snippets
- All /
« Prev 1 Next »
This Perl snippet shows how to separate quoted parts from a text in order to process quoted and unquoted parts separately. For example, you could expand variables or wildcards only in the unquoted part. Then the different processed parts are put to...
0
897
posted 12 years ago by deepsoul
The `filtermap` functional below allows to perform the standard `map` and `filter` operations in one go. The mapping function has to return a `Maybe` monad, and values of `Nothing` are filtered out.
0
1876
posted 13 years ago by deepsoul
This snippet shows how to replace the colours in a monochrome image, i.e. one which only contains two colours and the range of hues between them.
0
706
posted 14 years ago by deepsoul
The Google search URL accepts two fields, `as_oq` and `as_eq`, which give additional required or forbidden keywords for the search. This allows to create search forms which add preset keywords. In the search form below, one of the keywords test, re...
0
875
posted 14 years ago by deepsoul
This script creates thumbnail images containing 25 thumbs each and display the EXIF time and date if your version of ImageMagick supports that (some do not).
0
743
posted 15 years ago by deepsoul
Useful if some files already exist at the destination and are newer or would take too long to copy again.
0
662
posted 15 years ago by deepsoul
When you put an image in a printable document, you don't want it to have black (or coloured) background. ImageMagick allows to replace colours even when the coloured regions are non-contiguous. Arbitrary colour values can be specified with `\#12345...
0
717
posted 15 years ago by deepsoul
Find the most recently modified file in a directory tree and output its name and modification time. Use index 8 or 10 instead of 9 for access and inode modification time, respectively (see perlfunc manual page - function stat).
This is great for...
0
834
posted 15 years ago by deepsoul
The shell command which provides documentation for Ruby's classes and methods is:
0
737
posted 15 years ago by deepsoul
Perl hash sets are hashes used to represent sets. Their keys are the set elements, and the corresponding values are just 1. For keys that are not set elements, the hash will return undef, equivalent to false.
Adding a whole array to a hash set i...
0
926
posted 15 years ago by deepsoul
The tetex implementation of BibTeX, LaTeX's bibliography tool, forcibly breaks lines above a certain length (79 chars) by inserting % signs and line feeds, unless they can be broken between words. This is a problem when URLs are referenced, or if co...
0
951
posted 15 years ago by deepsoul
When using `ln` to create a link in a different directory, the semantics of creating hard and symbolic links differ. That is because a hard link contains a direct reference to its target's data, while a symbolic link is just a string containing a (p...
1
869
posted 15 years ago by deepsoul
`\mathbf` does not put operators and greek characters in bold face. This macro does.
1
985
posted 15 years ago by deepsoul
These four LaTeX control sequences are workalikes of the built-ins \show, \showthe and \def and of a command sequence call. Unlike the usual variants, they work on internal macros which contain characters with the "wrong" category code, such as "@"....
0
1031
posted 15 years ago by deepsoul
URLs:
<http://www.chiark.greenend.org.uk/~sgtatham/utils/> <http://kitenet.net/~joey/code/moreutils/>
Use one of these nifty utilities to automatically process files in-place. Both store the results of programs which write to stdout until t...
0
756
posted 15 years ago by deepsoul
The following shell function returns the canonicalised abolute path of a file. It resolves symbolic links, /./ and /../ as applicable. This was adapted from various sources. Related snippets on snipplr are [Find absolute path of Bash script](http:...
0
736
posted 15 years ago by deepsoul
By default ps2pdf re-encodes images, which usually reduces their quality. The commandline below prevents that. It also embeds fonts into the PDF, making it more portable. Substitute -sPAPERSIZE=letter if you are American.
0
1023
posted 15 years ago by deepsoul