Only tested in Chrome
A Pen by Felipe Marcos on CodePen.
#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> |
/* 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 |
command "hist", "Show and replay Readline history" do |*args| | |
require 'slop' | |
if args.empty? | |
text = add_line_numbers(Readline::HISTORY.to_a.join("\n"), 0) | |
stagger_output(text) | |
next | |
end | |
opts = Slop.parse(args) do | |
banner "Usage: hist [-rSTART..END]" |
pry(Module):4> show-method define_method | |
-- | |
From Ruby Core (C Method): | |
-- | |
static VALUE | |
rb_mod_define_method(int argc, VALUE *argv, VALUE mod) | |
{ | |
ID id; | |
VALUE body; | |
int noex = NOEX_PUBLIC; |
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)" |