Skip to content

Instantly share code, notes, and snippets.

Avatar

Aaron Ott aaronott

  • Rule4
  • Thornton, CO
View GitHub Profile
View crt_w_ip.sh
#!/bin/bash
tst=$1
for dom in $(curl -s https://crt.sh/?q=%25.${tst} | grep ${tst} |grep TD |grep -v LIKE |cut -d">" -f2 | cut -d"<" -f1 |sort |uniq);
do
ip=$(ping -c 1 $dom | gawk -F'[()]' '/PING/{print $2}') ; echo "${dom} (${ip})" >> ${tst}_w_IP.txt ;
done
@aaronott
aaronott / doc_search.sh
Created Feb 15, 2019
grep through .docx files
View doc_search.sh
#!/bin/bash
for f in *.docx; do if [[ $(unzip -p $f | grep -l "$1") ]] ; then echo "$f contains a match"; fi ; done
View parse_logger++.py
#!/usr/bin/env python
import csv
import sys
if len(sys.argv) < 2 :
sys.exit('Usage: %s <csv file>' % sys.argv[0])
with open(sys.argv[1], 'r') as csvfile:
reader = csv.reader(csvfile)
View new_page.sh
#!/bin/bash
DIARY_DIR=~/Documents/.diary
PAGE_NAME="$(date +'%F')-$(date +'%a' | head -c 1)-log.md"
vi $DIARY_DIR/$PAGE_NAME
@aaronott
aaronott / index.txt
Created May 4, 2018
blackhole_links
View index.txt
<?php
$max_num_links = 7;
$page = "/";
if (isset($_SERVER['REQUEST_URI'])) {
$page = htmlentities(rtrim($_SERVER['REQUEST_URI'], "/"));
}
?>
<h1>Hidden links</h1>
<h2><?php echo $page; ?></h2>
View db_backup.sh
#!/bin/sh
DBNAME=<database>
DBUSER=<dbuser>
DBPASS=<good-strong-password?>
DBHOST=localhost
DESTDIR=/path/to/backup/dir
NAME=<site-name>
RETENTION=2
let MMIN=($RETENTION*60*24)-30
View docroot_backup.sh
#!/bin/sh
SOURCEDIR=/path/to/docroot
DESTDIR=/path/to/backup/dir
NAME=<site-name>
RETENTION=2
let MMIN=($RETENTION*60*24)-180
DATE=`date +%Y-%m-%d-%H-%M`
EXCLUDE=""
View keybase.md

Keybase proof

I hereby claim:

  • I am aaronott on github.
  • I am aaronott (https://keybase.io/aaronott) on keybase.
  • I have a public key whose fingerprint is FFA3 8675 F349 D340 87C1 76C8 6940 15D1 2B44 AF03

To claim this, I am signing this object:

View bash_drush_truncate_table.sh
for t in `drush sqlq 'show tables like "cache%"'`; do `drush sqlq "truncate $t"`; done
View lifeblocks.html
<html>
<head>
<title>life in blocks</title>
<style>
span {
width:5px;
height:8px;
border:1px solid black;
display:block;