This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
user=root | |
password=admin | |
result=$(mysql melbdatathon2017 -hmysql -u $user -p$password<<<"SELECT DISTINCT postcode FROM stores") | |
post_code_list=(`echo ${result}`) | |
delete=(postcode) | |
array=( "${post_code_list[@]/$delete}" ) | |
for post_code in "${array[@]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
AWS=/home/`whoami`/.local/bin/aws | |
DATE=`date "+%Y%m%d-%H"` | |
BUCKET=<change me> | |
AWS_PROFILE=<change me> | |
BACKUPDIR=/mnt/share/backup/tshark/ | |
TMPDIR=/tmp/${DATE}/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:6.10 | |
RUN mkdir -p /var/task | |
WORKDIR /var/task | |
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ | |
apt-get upgrade -y && \ | |
apt-get install -y --no-install-recommends build-essential g++ python2.7 python2.7-dev unzip zip curl wget && \ | |
apt-get autoremove -y && \ | |
rm -rf /var/lib/apt/lists/* && \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -ex | |
exec > >(tee /var/log/rc.local.log|logger -t rc.local -s 2>/dev/console) 2>&1 | |
# | |
# rc.local | |
# | |
# This script is executed at the end of each multiuser runlevel. | |
# Make sure that the script will "exit 0" on success or any other | |
# value on error. | |
# | |
# In order to enable or disable this script just change the execution |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Usage: date | ./slack-post.sh | |
# Usage: echo "Hello Word" | ./slack-post.sh | |
webhook_url=https://hooks.slack.com/services/... | |
while read LINE; do | |
text="$text\n$LINE" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
########################### | |
# pip install python-nmap | |
# usage: | |
# ./scanner.py -i 59.x.x.x | |
# This will take a while, press 's' on the keyboard to | |
# see the elapsed time (and know it's still running the scan) | |
import nmap | |
import argparse | |
import termios, fcntl, sys, os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
######################################### | |
# pip install pandas ipwhois | |
# usage: | |
# ./collect-ip-info.py | |
# Place a csv in same directory and change name of file_in variable | |
# First csv row is header, followed by a single ip per row | |
# Make sure you put your own google maps api key below | |
import csv | |
import requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
################################## | |
# pip install netaddr | |
from netaddr import IPAddress, IPNetwork | |
file_out = "./internet-connected.csv" | |
with open(file_out, mode='a+') as f: | |
for class_a in range(0, 255): | |
a = IPAddress("%s.0.0.0" % class_a) | |
if not a.is_reserved(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# script to check website status (online/ofline) | |
while read site | |
do | |
if wget -p "$site" -O /dev/null &>/dev/null; then | |
echo "$site is up" | |
else | |
# action to do if website offline | |
echo "[$(date +%d-%m-%Y:%H:%M:%S)] $site is not reachable." | ./slack-post.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -o errexit | |
systemd-cat -t "cpu-temp" \ | |
echo "CPU `sensors | grep "CPU Temperature" | sed -e 's/[^0-9]/ /g' -e 's/^ *//g' -e 's/ *$//g' | tr -s ' ' | sed 's/ /\n/g' | head -n1 | xargs`°C" | |
exit 0 |