This article is now published on my website: Prefer Subshells for Context.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| INFO=$(xwininfo -frame) | |
| WIN_GEO=$(echo $INFO | grep -oEe 'geometry [0-9]+x[0-9]+' |\ | |
| grep -oEe '[0-9]+x[0-9]+') | |
| WIN_XY=$(echo $INFO | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' |\ | |
| grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/+/,/' ) | |
| ffmpeg -f x11grab -y -r 15 -s $WIN_GEO -i :0.0+$WIN_XY -vcodec ffv1 -sameq -f alsa -ac 2\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * drivertest.cpp | |
| * Vector addition (host code) | |
| * | |
| * Andrei de A. Formiga, 2012-06-04 | |
| */ | |
| #include <stdio.h> | |
| #include <stdlib.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class FullPaths(argparse.Action): | |
| """Expand user- and relative-paths""" | |
| def __call__(self, parser, namespace, values, option_string=None): | |
| setattr(namespace, self.dest, os.path.abspath(os.path.expanduser(values))) | |
| def is_dir(dirname): | |
| """Checks if a path is an actual directory""" | |
| if not os.path.isdir(dirname): | |
| msg = "{0} is not a directory".format(dirname) | |
| raise argparse.ArgumentTypeError(msg) |
NewerOlder