How to add watermarks to images via command line – Hopefully using Irfanview

I recommend using ImageMagick, which is open source and quite standard for manipulating images on the command line. Watermarking with an image is as simple as composite -dissolve 30% -gravity south watermark.jpg input-file.jpg output-file.jpg With text, it’s a little more complicated but possible. Using the above command as an example, a Bash command for doing … Read more

How can I process command line arguments in Python? [duplicate]

As others answered, optparse is the best option, but if you just want quick code try something like this: import sys, re first_re = re.compile(r’^\d{3}$’) if len(sys.argv) > 1: if first_re.match(sys.argv[1]): print “Primary argument is : “, sys.argv[1] else: raise ValueError(“First argument should be …”) args = sys.argv[2:] else: args = () # … anywhere … Read more

How to set the exit status code in a Symfony2 command?

In the base Command class: if ($this->code) { $statusCode = call_user_func($this->code, $input, $output); } else { $statusCode = $this->execute($input, $output); } return is_numeric($statusCode) ? (int) $statusCode : 0; So simply return the exit code from your execute() function. Your console command will exit with this code as long as it is a numeric value.

Removing a key from parent object with jq

Using the builtin function del: $ jq ‘del(.pages)’ myfile.json { “actions”: { “pages”: { “stuff”: “…” } } } Try it online at jqplay.org To remove all pages everywhere, instead of just the outer level, you would use something like $ jq ‘del(.. | .pages?)’ myfile.json { “actions”: {} } Try it online at jqplay.org

Programmatically launch Terminal.app with a specified command (and custom colors)

You can open an app by bundle id too, and give other parameters. If there’s an executable script test.sh in the current directory, the following command will open and run it in Terminal.app open -b com.apple.terminal test.sh The only down side that I can find is that Terminal doesn’t appear to inherit your current environment, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)