Skip to content

Instantly share code, notes, and snippets.

View jettero's full-sized avatar
🕸️
Hliðskjálf

Paul Miller jettero

🕸️
Hliðskjálf
View GitHub Profile
@jettero
jettero / xlate.vim
Last active August 29, 2018 12:33
Attempt at rational re-writing of salt://whatever/file.sls into something else (part 1 of ??)
" vi:ft=vim:
" in the olden days, this was how I opened files. I like having gf actually
" issue <c-w>f (open the file under cursor in a new window); but occasionally,
" I really want the original gf; which I map to gF
nmap gf <C-w>f
nnoremap gF gf
" the above works just fine for the below actual filepath
@jettero
jettero / pycfg.vim
Last active July 7, 2018 13:28
python configparser syntax for vim
" Vim syntax file
" Language: Python configparser
" Maintainer: Paul Miller (jettero@github)
" EARL: https://gist.github.com/jettero/4a619004fb23ada1e5cf302211eee8ae
" Last Change: 2018-07-07
" Ripped from:
" lang: Good old CFG files
" maint: Igor N. Prischepoff (igor@tyumbit.ru, pri_igor@mail.ru)
" their lc: 2018 Jul 06
@jettero
jettero / conftest.py
Last active June 29, 2018 14:56
pytest cli (aka livelog) filtered output
import pytest, logging, os
class OnlyMe(logging.Filter):
_only_one = None
my_path = os.path.dirname(
os.path.dirname(
os.path.abspath(__file__)))
@classmethod
def scramble_every_zig(cls):
@jettero
jettero / my-crypt-mount.sh
Created June 7, 2018 13:49
my very secret files mount/umount kit
#!/bin/bash
DIR="$(dirname "$(realpath "$0")")"
CREATE=no
while [ -z "$MAP" ]; do
if [ -n "$1" ]
then MAP="$1"; shift
else
echo current image files:
@jettero
jettero / ssh-agent-zookeeper.sh
Last active December 8, 2017 18:23
my ssh-agent zookeeper
# to use from your .bashrc, do something like:
# if [[ "$-" =~ i ]]; then ~/.ssh-agent-zookeeper.sh; ssh-zoo; fi
function _source_agent_vars {
if [ -z "$SSH_AGENT_SOCKET_FILE" ]; then
echo run the ssh-zoo-setup first
return 1
fi
[ -f "$SSH_AGENT_VARS_FILE" ] && source "$SSH_AGENT_VARS_FILE"
@jettero
jettero / nine.py
Created September 12, 2017 12:36
This is 9.
#!/usr/bin/env python
# coding: UTF-8
import argparse
def nine(x):
retval = x # <--- the given integer
# side note: recursion can always be converted to a loop
# particularly tail recursion like this would have been
@jettero
jettero / workaround-upstart-snafu
Created July 12, 2017 13:56
work around a goofy problem in upstart
#!/usr/bin/env perl
# occasionally when you're designing upstart services in /etc/init/whatever.conf
# you pick the wrong 'no expect' `expect fork` or `expect daemon` and upstart beings
# tracking a pid that is already dead. It'll be stuck there refusing to start or stop the service until
# it tracks the pid exiting again. So this script forkexists over and over and over until it gets the pid
# upstart is waiting for, then exits.
# NOTE: sometimes the upstart user prevents this from working, if applicable
# ssh to localhost to make sure our ppid is 1 after we die.
@jettero
jettero / splunkforwarder.conf
Created July 12, 2017 13:49
upstart config for splunkforwarder
# vi:ft=upstart:
# this is really the only logical way to start the thing
# upstart doesn't take kindly to process startup that forks more than twice
# and custom stops in pre-stop don't really work quite right. If you want this tracking sorta
# the right pid in 'service splunkforwarder status' then you have to --nodaemon (imo)
# -jettero@gmail.com
description "Splunk Forwarder"
start on (net-device-up
@jettero
jettero / splunktime2rationaltime.user.js
Last active October 9, 2018 18:07
Splunk insists on using the locale based time in the _time column of search results; even though my LC_TIME locale is en_DK.utf8; this gives me a nice short big-to-small time format
// ==UserScript==
// @name Splunk-time to Rational-time
// @namespace org.voltar.splunktime2rational
// @version 0.31
// @downloadURL https://goo.gl/7qizYC
// @description Splunk insists on using the locale based time in the _time column of search results; even though my LC_TIME locale is en_DK.utf8; this gives me a nice short big-to-small time format
// @author https://github.com/jettero
// @require https://openuserjs.org/src/libs/sizzle/GM_config.js
// @match *://*splunk*/*-*/app/*/search*
// @match *://*/splunk/*-*/app/*/search*
@jettero
jettero / go.pl
Last active April 26, 2017 16:20
I taught this to go to window items, not just windows --- original: https://scripts.irssi.org/scripts/go.pl
use strict;
use vars qw($VERSION %IRSSI);
use Irssi;
use Irssi::Irc;
# Usage:
# /script load go.pl
# If you are in #irssi you can type /go #irssi or /go irssi or even /go ir ...
# also try /go ir<tab> and /go <tab> (that's two spaces)
#