Only tested in Chrome
A Pen by Felipe Marcos on CodePen.
| #include <iostream> | |
| #include <type_traits> | |
| template <typename...> | |
| struct typelist; | |
| template <uint32_t n, typename Head, typename...Tail> | |
| struct nthElement; | |
| template <uint32_t n, typename Head, typename...Tail> | 
| /* Copied, Pasted and summarized from ps' source code. | |
| You can use sysctl to get other process' argv. | |
| */ | |
| #include <sys/sysctl.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #define pid_of(pproc) pproc->kp_proc.p_pid | 
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <fcntl.h> | |
| #include <sys/uio.h> | |
| #include <unistd.h> | |
| #include <string.h> | |
| #include <sys/errno.h> | |
| #include <sys/types.h> | |
| #include <sys/ioctl.h> | |
| #include <net/bpf.h> | 
file
| #!/usr/bin/env bash | |
| CLIENT_ID=<REDACTED> | |
| LOG_FILE=~/.image_uploader.log | |
| touch $LOG_FILE | |
| exec 1>>$LOG_FILE # redirect stdout to the log file | |
| exec 2>&1 # ditto for stderr | 
| #!/usr/bin/env bash | |
| set -x | |
| CLIENT_ID=<REDACTED> | |
| LOG_FILE=~/.image_uploader.log | |
| touch $LOG_FILE | |
| # folder to watch | |
| SCREENSHOT_FOLDER=/home/user/Pictures/screenshots | 
| gitwalk() { | |
| git log ${1}..HEAD --oneline | awk '{print $1}' | tac | xargs -I{} -n1 sh -c 'git log -p {}' | |
| } | 
| main() { | |
| # Use colors, but only if connected to a terminal, and that terminal | |
| # supports them. | |
| if which tput >/dev/null 2>&1; then | |
| ncolors=$(tput colors) | |
| fi | |
| if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then | |
| RED="$(tput setaf 1)" | |
| GREEN="$(tput setaf 2)" | |
| YELLOW="$(tput setaf 3)" | 
| main() { | |
| # Use colors, but only if connected to a terminal, and that terminal | |
| # supports them. | |
| if which tput >/dev/null 2>&1; then | |
| ncolors=$(tput colors) | |
| fi | |
| if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then | |
| RED="$(tput setaf 1)" | |
| GREEN="$(tput setaf 2)" | |
| YELLOW="$(tput setaf 3)" |