Skip to content

Instantly share code, notes, and snippets.

View dword4's full-sized avatar

Drew Hynes dword4

View GitHub Profile
@dword4
dword4 / imgur2pdf.py
Last active January 22, 2024 19:17
Convert imgur album to a pdf file
#!/usr/bin/python
from imgurpython import ImgurClient
from PIL import Image
from creds import *
import PIL
from reportlab.pdfgen import canvas
from reportlab.platypus import SimpleDocTemplate, Paragraph, Image, Spacer, PageBreak
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.pagesizes import letter
from reportlab.lib.units import inch
@dword4
dword4 / nextdays.py
Created February 9, 2015 05:50
simple script to build URLs for the next few days
#!/usr/bin/python
import datetime
import calendar
day = datetime.date.today().strftime("%d")
month = datetime.date.today().strftime("%m")
year = datetime.date.today().strftime("%Y")
strip_month = datetime.date.today().strftime("%-m")
@dword4
dword4 / system_help.sh
Created January 15, 2016 05:10
collect some basic system data for troubleshooting
#!/bin/bash
SCRIPT_VERSION="0.1"
# things to check
# internal ip, external ip, dns server, connectivity to google
# filesystem usage, current system load, memory usage
> log.log
date >> log.log
IP=`ip addr | grep -P -o '\d{1,3}.\d{1,3}\.\d{1,3}\.\d{1,3}\/24'`
#@module.commands('lasttopic')
def last_topic(bot, trigger):
channel_list = []
conn_channels = bot.privileges
for channel in conn_channels:
if channel not in channel_list:
channel_list.append(channel)
for chan in channel_list:
if chan == '#t3st':
set t_Co=256
if has("syntax")
syntax on
endif
set novisualbell
set hlsearch
"colorscheme apprentice
"colorscheme slate
"colorscheme dword2
@dword4
dword4 / deploy-salt.sh
Created November 5, 2017 01:01
simple script to deploy salt-minion on a vm, requires ssh key be copied over first
#!/bin/bash
HOST=$1
echo "deploying salt -> $HOST"
ssh root@$HOST "yum -y install epel-release && yum -y install salt-minion"
ssh root@$HOST "sed -i 's/#master: salt/master: 192.168.1.50/g' /etc/salt/minion"
ssh root@$HOST "systemctl start salt-minion && systemctl enable salt-minion"
ssh root@$HOST "systemctl stop firewalld && systemctl disable firewalld"
echo "salt successfully deployed
@dword4
dword4 / keybase.md
Created December 30, 2017 17:07
keybase.md

Keybase proof

I hereby claim:

  • I am dword4 on github.
  • I am dword4 (https://keybase.io/dword4) on keybase.
  • I have a public key ASCO6E0SX6H7NNGE4r9ourvAjFQrWtI6xeaaeb0zqOngWQo

To claim this, I am signing this object:

@dword4
dword4 / sadmoney.py
Created January 3, 2018 21:00
quick bit of python to figure out how much has been spent on any given thing
#!/usr/bin/python3
import pandas as pd
import numpy as np
import sys
target = sys.argv[1]
def getTargetTotal(target):
df = pd.read_csv('data.csv', header=None,names=['date','description','ammount','balance'])
@dword4
dword4 / fun.py
Created March 3, 2018 03:31
using up alphabet characters via NATO phonetics
#!/usr/bin/python3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
chars = list(alphabet)
words = ['alpha','bravo','charlie','delta','echo','foxtrot','golf','hotel','india','juliett','kilo','lima','mike','november','oscar','papa','quebec','romeo','sierra','tango','uniform','victor','whiskey','xray','yankee','zulu']
for w in words:
# loop through each word specified
@dword4
dword4 / gist:7f02b1bd76fe4839f3f367fc945b9eda
Last active March 15, 2018 21:09
LibreNMS adding a device with salt
# adds a device forcefullly in LNMS via the API
lnms_api_add:
cmd.run:
- name: >-
curl -X POST --data-binary '{"hostname":"{{ salt['grains.get']('ip4_interfaces:ens18:0') }}","force_add":"true","port":"161","version":"v2c","community":"public"}' -k -v -H 'X-Auth-Token: SOMEAPITOKEN' 'http://192.168.1.85/api/v0/devices'