Encoding issues during PostgreSQL backup restore
Issues I bumped into during restoration of a PostgreSQL backup.
Issues I bumped into during restoration of a PostgreSQL backup.
If you want to remotely access your SSH account (e.g. NAS in home) and listen to the music or watch some movies without downloading them in the first place, you can use the following command: ssh [email protected] cat mediaFile.avi | mplayer - It will connect to your.host.com, log into the user account, invoke the cat command on the given mediaFile.avi and transfer the output (stream of bytes) to your local mplayer....
Some time ago I’ve posted about using multiple -exec options for find command which can be used to find in what JARs particular class lies. Below you can find enriched and more intuitive/detailed solution for finding your class in a bunch of JARs: #!/bin/bash if [ $# -lt 1 ] then echo 'Usage: jarfind CLASS_NAME [DIR_WITH_JARS]'; exit 1; fi WHAT="$1" if [ $# -eq 2 ] then WHERE="$2" else WHERE="." fi FIND_RESULT=`find "$WHERE" -maxdepth 2 -name '*....
If you’re using BASH find and want to find files which are named differently than the given pattern, you can use the following syntax: find . -type f ! -iname "*.class" The above command will find all files in the current directory (and subdirectories) which have the extension different (exclamation mark) from “class” (case insensitive). You can also use conditional operations to build slightly more complicated commands, like: find . -type f !...
If you want to create every possible word or combination of letters (or any other characters) you can use very simple BASH function: $ echo {a..c} This command will print all possible letters starting with a and ending on c (inclusive), so the result is: a b c You can get every possible combination of letters from the given range, which length is larger than 1, i.e.: $ echo {a..c}{a..c} This command will print every possible combination of letters starting with a and ending on c (inclusive) with another letter from the same range....
I wondered why the same word has different MD5 checksum if I use the PHP md5(-) method and BASH md5sum command. What I mean is: <?php echo md5("sol"); ?> The result is: 12313a3d28f802e3a22b07d2e01c6dcf $ echo "sol"|md5sum The result is: 56717d999058f0e053d4b580c9396a92 It’s so because the echo command – by default – adds a newline character after its execution, so it really creates a MD5 checksum of: ‘sol\n’. To avoid it, you can use the -n echo switch which disables the trailing newline character for this command....
Below is a BASH command which will find all undefined acronyms used in a LaTeX text. The result can be pasted into the appendix which lists the used acronyms. cat temp.txt |grep -oe "([A-Z]*\!)"|tr -d '\!()'|sort|uniq|xargs -i echo '\acro{'{}'}{'{}'}' Exemplary result: \acro{TRM}{TRM} \acro{VM}{VM} \acro{WML}{WML} \acro{XP}{XP}
I like to keep my system clean and secured. Unfortunately, the GUI interface for iptables isn’t really matching my expectations. So I would like to create simple bash script which will execute iptables rules with every system boot-up. By default it blocks all incoming AND outgoing traffic also, so be careful :-) If you want to open another port – you just need to add it to the INPUT_OUTPUT list. Take a look at the source of the script:...