>>> from signal import Signals
>>> possible_signals = [(name, getattr(signal, name)) for name in dir(Signals) if name == name.upper()]
>>> valid_signals = [(name, signal) for name, signal in possible_signals if isinstance(signal, Signals)]
>>> len(valid_signals)
41
>>> [(name, signal.real) for name, signal in valid_signals]
[('SIGABRT', 6),
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
#!/usr/bin/env bash | |
set -exu |
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
# Output a single frame from the video into an image file: | |
ffmpeg -i input.mov -ss 00:00:14.435 -vframes 1 out.png | |
# Output one image every second, named out1.png, out2.png, out3.png, etc. | |
# The %01d dictates that the ordinal number of each output image will be formatted using 1 digits. | |
ffmpeg -i input.mov -vf fps=1 out%d.png | |
# Output one image every minute, named out001.jpg, out002.jpg, out003.jpg, etc. | |
# The %02d dictates that the ordinal number of each output image will be formatted using 2 digits. | |
ffmpeg -i input.mov -vf fps=1/60 out%02d.jpg |
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
https://linktr.ee/falcaogabriel |
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
457256DB220D76CA139A6F837A9C17E806F18A32 |
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/bash | |
original="$1" | |
replacement="$2" | |
echo "Replacing $original with $replacement" | |
ack -l $original * | cut -d: -f1 | uniq | xargs gsed -i "s,$original,$replacement,g" | |
if [ -z $3 ]; then | |
original=`echo $original | tr '[:lower:]' '[:upper:]'` |
I recently happened upon an implementation of popen()
(different API, same idea) using clone(2)
, and so I opened an issue requesting use of vfork(2)
or posix_spawn()
for portability. It turns out that on Linux there's an important advantage to using clone(2)
. I think I should capture the things I wrote there in a better place. A gist, a blog, whatever.
So here goes.
Long ago, I, like many Unix fans, thought that fork(2)
and the fork-exec process spawning model were the greatest thing, and the Windows sucked for only having [exec*()
](http://pubs.opengroup.org/onlinepubs/9699919
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
554: export PS1="\[$(tput setaf 45)\]\W\[$(tput setaf 199)\]\$(git_branch)\[\e[0m$(tput setaf 190)\]\$\e[0m \[$(tput sgr0)\]\[\e[0m\]" |
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
// Example of test pyramid using jest | |
// Basic usage: | |
// jest --selectProjects 'unit tests' | |
// Assumes that you organize tests under __${type}_tests__/**/*.js | |
// | |
const path = require('path'); | |
const correctPath = value => path.resolve(__dirname, value || ''); |
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
git config core.sshCommand "ssh -i ~/.ssh/id_rsa_example -F /dev/null" |