Skip to content

Instantly share code, notes, and snippets.

View wwalker's full-sized avatar

Wayne Walker wwalker

View GitHub Profile
@wwalker
wwalker / args.sh
Created December 7, 2019 18:26
bash args
#!/bin/bash
args=()
arg_parser(){
shift
shift
while (( $# > 0 )); do
args+=("$1")
shift
@wwalker
wwalker / _expectations.md
Created December 7, 2019 07:00
harumph arg parser

I would expect to get

3 4 5 6
3 4 5 6

but the shifted parameters are still in place :-(

wwalker@serenity:~ ✓ $ ./a.sh 1 2 3 4 5 6
3 4 5 6
1 2 3 4 5 6
wwalker@polonium:~/timeouts ✘ $ curl -X GET 'https://threatgrid.app.vividcortex.com/api/v2/queries/samples/search?from=1556668800&offset=0&limit=400&query=%7B%22filters%22:%5B%7B%22attribute%22:%22latency%22,%22operator%22:%22%3E%22,%22value%22:120%7D%5D%7D&until=1574208000&host=11' -H 'Authorization: Bearer pT113awxsl1GBNgfdFdjfkoBZrMDqWgx' -H 'X-Indent: true' > 0.out
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 126k 0 126k 0 0 195k 0 --:--:-- --:--:-- --:--:-- 195k
wwalker@polonium:~/timeouts ✓ $ curl -X GET 'https://threatgrid.app.vividcortex.com/api/v2/queries/samples/search?from=1556668800&offset=400&limit=400&query=%7B%22filters%22:%5B%7B%22attribute%22:%22latency%22,%22operator%22:%22%3E%22,%22value%22:120%7D%5D%7D&until=1574208000&host=11' -H 'Authorization: Bearer pT113awxsl1GBNgfdFdjfkoBZrMDqWgx' -H 'X-Indent: true' > 400.out
#include "grab-keyboard.h"
static int ApplicationErrorHandler(Display *display, XErrorEvent *theEvent)
{
exit(127); /* clearly we aren't calling the error handler :-( */
(void) fprintf(stderr,
"Ignoring Xlib error: error code %d request code %d\n",
theEvent->error_code,
theEvent->request_code) ;
#include "grab-keyboard.h"
static int ApplicationErrorHandler(Display *display, XErrorEvent *theEvent)
{
exit(127); /* clearly we aren't calling the error handler :-( */
(void) fprintf(stderr,
"Ignoring Xlib error: error code %d request code %d\n",
theEvent->error_code,
theEvent->request_code) ;
#include "grab-keyboard.h"
int main(int argc, char **argv)
{
Display *dpy;
int x=0;
XEvent ev;
if((dpy = XOpenDisplay(NULL)) == NULL) {
perror(argv[0]);
@wwalker
wwalker / postgres.conf
Created November 10, 2019 17:35
logging parameters
logging_collector = off # Enable capturing of stderr and csvlog
log_min_duration_statement = 1000 # -1 is disabled, 0 logs all statements
log_checkpoints = on
log_line_prefix = '%m [%p]: u=[%u] db=[%d] app=[%a] c=[%h] s=[%c:%l] tx=[%v:%x] '
log_statement = 'ddl' # none, ddl, mod, all
log_timezone = 'UTC'
@wwalker
wwalker / README-setup-tunnel-as-systemd-service.md
Created October 23, 2019 23:29 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/[email protected]. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@wwalker
wwalker / .bash_logout
Last active October 18, 2019 00:14
How to get bash per session history files, which is updated with each command in real time, and, upon session exit, appends the entire session history to ~/.bash_history
# Take the session history and append it to the .bash_history file, and if successful, remove the session file
cat "$HISTFILE" >> "$HOME"/.bash_history && /bin/rm "$HISTFILE"
@wwalker
wwalker / .gitattributes
Created October 11, 2019 16:31 — forked from marceloalmeida/.gitattributes
How to show diffs for gpg-encrypted files?
*.gpg filter=gpg diff=gpg
*.asc filter=gpg diff=gpg