Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Put all kernel audit messages in a log file we can search with ausearch
cat /var/log/messages | grep -o -E "audit: .*" | sed -e 's/audit: //g' > /tmp/kernel_audit.log
# Grab all failing audit entries
entries=$(cat /tmp/kernel_audit.log | grep "success=no" | grep -E "(datadog-agent|beam)" | \
grep -o -E "audit\([0-9]+\.[0-9]+:[0-9]+\)" | cut -d: -f2 | grep -o -E "[0-9]+")
# Display human-friendly version of each entry
@kevsmith
kevsmith / config.yml
Created April 24, 2018 18:08
go-jira config example
# Get an API token here: https://id.atlassian.com/profile
# go-jira will prompt for it once and then store it
# in OS X's Keyring
endpoint: https://adroll.atlassian.net
user: first_name.last_name
login: first_name.last_name@adroll.com
authentication-method: api-token
project: RTI
password-source: keyring
@kevsmith
kevsmith / productivity.md
Last active August 5, 2023 19:34
Elon Musk's Productivity Tips

Progress, Precision and Profit

[...removed Tesla-specific commentary...]

Btw, here are a few productivity recommendations:

  • Excessive meetings are the blight of big companies and almost always get worse over time. Please get rid of all large meetings, unless you’re certain they are providing value to the whole audience, in which case keep them very short.

  • Also get rid of frequent meetings, unless you are dealing with an extremely urgent matter. Meeting frequency should drop rapidly once the urgent matter is resolved.

@kevsmith
kevsmith / git-branches
Last active May 17, 2017 15:15
View age information about local, remote, and merged-to-master git branches
#!/bin/sh
# Valid branch types: remote, local, merged
local_branch_opt="-a"
remote_branch_opt="-r"
merged_branch_opt="-a --merged master"
@kevsmith
kevsmith / git-purge
Created January 9, 2017 15:15
Keep local branches in sync with merged branches
#!/bin/sh
set -e
delete_branch() {
git branch -d "$1"
}
usage() {
echo "git purge [-d|--delete] [-e|--regex <regular_expression>]"
@kevsmith
kevsmith / select_vs_find.rb
Created September 14, 2016 12:09
How does this work?
#!/usr/bin/env ruby
# For reference see https://github.com/cogcmd/pagerduty/blob/master/lib/cog_cmd/pagerduty/oncall.rb#L29
# Some test users
users = [{id: 1,
name: "Bob",
email: "bob@example.com",
policy_ids: [1,2]},
{id: 2,
@kevsmith
kevsmith / cogctl
Created August 22, 2016 14:34
NYLUG demo scripts
#!/bin/bash
# Uses cogctl built from a release
# Keeps .cogctl from stomping on the
# file stored in $HOME
scriptdir=$(dirname ${0})
configdir=$(cd ${scriptdir}/.. && pwd)
real_cogctl=${scriptdir}/cogctl2
@kevsmith
kevsmith / research.md
Created August 1, 2016 22:03
CLI & interactive programming research

Gracoli: A graphical CLI

Command Line Interface (CLI) is the most popular and basic user interface to interact with computers. Despite its simplicity, it has some limitations in terms of user experience. For example, sometimes it is hard to understand and interpret the textual output of the command. In this paper we describe the limitations of command line interfaces and propose Gracoli1: A graphical command line interface that takes advantage of both text-based interface and graphical user interface to provide better user experience and perform complex tasks. We demonstrate some of the useful applications and features of Gracoli. Sometime such a hybrid system provides and combines the strengths of CLI and GUI to perform specific tasks. We explore some useful applications of Gracoli to create a new kind of user experience. Command line interface makes accessibility faster and Graphical User-Interface makes output more interactive and understandable.

YouTube

@kevsmith
kevsmith / git-purge
Last active July 18, 2016 17:44
git helper script for managing local branch proliferation
#!/bin/sh
set -e
delete_branch() {
git branch -d "$1"
}
usage() {
echo "git purge [-d|--delete] [-e|--regex <regular_expression>]"
@kevsmith
kevsmith / b2f.erl
Last active November 2, 2021 09:15
Erlang/Elixir BEAM decompiler
#! /usr/bin/env escript
%% -*- mode: erlang -*-
%% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 ft=erlang et
%%
%% Copyright 2016 Operable, Inc. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file