Skip to content

Instantly share code, notes, and snippets.

@jondb
jondb / README.md
Last active June 24, 2017 23:52
Secure Wordpress Upgrade

Secure Wordpress Upgrade

What does this do?

  1. Downloads wordpress if it's newer than the last time this ran.
  2. Updates wordpress by overwriting the existing files.

What does this not do?

@jondb
jondb / readme.md
Created September 16, 2016 22:13
Using SSSS

Install

launch a new ubuntu image

Docker

docker run -i -t ubuntu /bin/bash
apt-get update
apt-get install ssss
#!/bin/bash
set -e
USAGE="$0 <username> <ssh_pubkey> <group,groups>"
if [ -z ${1+x} ]; then echo $USAGE; exit 1; fi
if [ -z ${2+x} ]; then echo $USAGE; exit 1; fi
USERNAME=$1

1) get the column names:

head -n 1 status_reports_2016-05-19T18-50-57+00-00.csv | pbcopy

2) import the csv into sqlite3

create table foo( <paste column names from #1> );
.mode csv
.import status_reports_2016-05-19T18-50-57+00-00.csv foo
@jondb
jondb / key
Last active February 12, 2016 20:30
#!/bin/bash
# Run this on every server:
# curl https://gist.githubusercontent.com/jondb/27f5395fbebf9701d71a/raw/ceba1231a5903566c5e24c61d0ce01f3e4e02a02/key | sudo sh
user=jon
key='ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCgJaMxxNllVsb7kMRPP/95skzfGMEYtbt2r30bQZ0vt/4KMRgrX4eK8tyCbXY9g4ohmMy/iSm+b5SVwLnV58haoQYvLOuauSO8N+Gvrgi5q7vU5XXzKm2JXfwORCBwlxv37c/5YSRL1IyATlIH4iex17L26bwdwScU6wfrFpUjxN+tNlcGVR79e2TZ1Xdtmwz7+JkCIMHj+sVrauSQvmwhj81nPwiHQqFV28vwNRHV8RX30HZMHo22kTmwNbs+U7EYiIFAeihvdR0ui77B2e54ARyBF+fm2Z9+N6wWk2qM1UyyW6tmiEMwCSvjfhTCU4cdVaHX9FJ9r32/Zu/rCyq1 jon@Jonathans-MacBook-Air.local'
/usr/sbin/useradd -m $user -s /bin/bash
passwd -d $user

Keybase proof

I hereby claim:

  • I am jondb on github.
  • I am jondb (https://keybase.io/jondb) on keybase.
  • I have a public key whose fingerprint is 4A3E 11E7 1298 0B54 A910 CE91 6AF3 B232 BB45 2B0F

To claim this, I am signing this object:

@jondb
jondb / alfredScript.sh
Last active September 15, 2015 21:37
OSX screen shot to /tmp and reveal in finder. Defaults to window mode and space to change to selector mode
query="{query}"
if [ $query != '' ]; then
/Users/jon/bin/snap -f={query}
else
/Users/jon/bin/snap
fi
@jondb
jondb / ossec -> json and ELK
Last active August 29, 2015 14:15
OSSEC alerts.json and ELK
moved: http://notes.is9.co/2015/02/18/ossec-json-elk/
#!/usr/bin/env python
# sample usage: checksites.py eriwen.com nixtutor.com yoursite.org
import pickle, os, sys, logging
from httplib import HTTPConnection, socket
from smtplib import SMTP
def email_alert(message, status):
fromaddr = 'you@gmail.com'
@jondb
jondb / acat.py
Last active December 17, 2015 16:09
Follow all includes in an apache file and cat the entire config to STDOUT.
#!/usr/bin/env python
"""Usage: acat.py <root-config-file>
This program takes the root apache config file and outputs it
to STDOUT following all Include directives.
source: https://gist.github.com/jondb/5637099
Get it:
curl https://gist.github.com/jondb/5637099/download | tar xvz --strip-components=1 && chmod +x acat.py
"""