Skip to content

Instantly share code, notes, and snippets.

@oskarpearson
oskarpearson / log-commands.sh
Created May 17, 2017 08:37
Log bash commands to syslog, even after sudo.
# Store this at /etc/profile.d/log-commands.sh mode 0644
#
# Log commands to syslog, where they will be picked up by the aws log watcher
function log2syslog
{
declare command
command=$BASH_COMMAND
if [ "$command" != "history -a" ]; then
logger -p local1.notice -t bash -i -- "$USER (sudo_user: $SUDO_USER) : $command"
fi

Keybase proof

I hereby claim:

  • I am oskarpearson on github.
  • I am oskarpearson (https://keybase.io/oskarpearson) on keybase.
  • I have a public key whose fingerprint is 49E6 8682 4F50 A52A C047 23D2 E93E 631C 8A69 3BAF

To claim this, I am signing this object:

@oskarpearson
oskarpearson / postgresql-email-inconsistencies
Last active July 14, 2016 17:13
Some inconsistencies with detection of email addresses in postgres
# select version();
version
-------------------------------------------------------------------------------------------------
PostgreSQL 9.5.3 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2, 64-bit
(1 row)
# SELECT email, to_tsvector('simple', email) FROM (
VALUES ('foo@example.com'), ('foo+123@example.com'),
('123+foo@example.com'), ('123+123foo@example.com'),
('foo123@example.com'), ('foo_123@example.com'),
@oskarpearson
oskarpearson / intel-edison-openaps-setup
Created January 3, 2016 23:08
Prepping for OpenAPS install on an Intel Edison
# Install UbiLinux
Follow the instructions on https://learn.sparkfun.com/tutorials/loading-debian-ubilinux-on-the-edison and then continue here.
# Initial Setup
Log in as edison/edison via serial console
su -
echo FIXME-thehostname-you-want > /etc/hostname