Skip to content

Instantly share code, notes, and snippets.

View falconindy's full-sized avatar
💭
Rumors of my demise have been greatly exaggerated

falconindy

💭
Rumors of my demise have been greatly exaggerated
View GitHub Profile
@falconindy
falconindy / up.sh
Last active September 19, 2018 19:56
A shell function to cd to files/directories in your parent
up() {
local cdinto=0 x= traverse= curpath=
[[ $1 ]] || { cd ..; return; } # default to 1 level
[[ $1 = -d ]] && { cdinto=1; shift; }
for x; do
if [[ $x == +([[:digit:]]) ]]; then
(( x == 0 )) && return # noop
#
# Example usage:
# $ git clone --depth=1 git://git.archlinux.org/svntogit/packages.git
# $ ( cd packages >/dev/null && find-https ) >unused-https.txt
#
has_https_available() {
local https_url url_eff
https_url=https${1#http}
@falconindy
falconindy / journalprintf.py
Last active November 10, 2021 23:04
Journal printer with custom formatting
#!/usr/bin/env python
'''
A journal reader which offers custom message formatting on output.
Example:
./journalprintf \
'{__REALTIME_TIMESTAMP} {_HOSTNAME} {_SYSTEMD_UNIT} {_COMM}[{_PID}]: {MESSAGE}' \
_SYSTEMD_UNIT=dnsmasq.service \

Keybase proof

I hereby claim:

  • I am falconindy on github.
  • I am dreisner (https://keybase.io/dreisner) on keybase.
  • I have a public key whose fingerprint is 487E ACC0 8557 AD08 2088 DABA 1EB2 638F F56C 0C53

To claim this, I am signing this object:

@falconindy
falconindy / latest.py
Created August 17, 2014 12:24
Operate on the newest or oldest files in a directory tree
#!/usr/bin/env python
import argparse, os, glob, sys, operator, fnmatch
def stderr(*args):
print(*args, file=sys.stderr, end='')
def filter_files(files, filterpat, root=""):
entries = {}
#!/bin/bash
check_backup() {
[[ -f $1 ]] && echo "$1"
}
awk '/^%BACKUP%$/ {
while (getline) {
if (/^$/) { nextfile }
print $1