Skip to content

Instantly share code, notes, and snippets.

View jheiselman's full-sized avatar

Jerry Heiselman jheiselman

View GitHub Profile
@jheiselman
jheiselman / matterbridge.toml
Created March 12, 2020 00:47
matterbridge config excerpt
[[gateway]]
name="mygateway"
enable=true
[[gateway.inout]]
account="discord.myserver"
channel="general"
[gateway.inout.options]
WebhookURL="https://discordapp.com/api/webhooks/NNNNN/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
[[gateway.inout]]
account="slack.myteam"
@jheiselman
jheiselman / wg0.conf
Created January 20, 2020 01:19
Wireguard Config
[Interface]
Address = 192.168.2.1/24
Table = 51820
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i %i -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i %i -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
ListenPort = 51820
PrivateKey = <PrivateKey>
# Jerry
[Peer]
@jheiselman
jheiselman / get_rackspace_console.ps1
Created December 14, 2016 18:57
Example of how to use JSON in PowerShell
if ($username -eq "" -or $api_key -eq "" -or $serverId -eq "") {
echo "Please edit this script and fill in the variables at the top before using it"
exit
}
$auth_body = @{
auth = @{
"RAX-KSKEY:apiKeyCredentials" = @{
username = ""
apiKey = ""
@jheiselman
jheiselman / get_books.py
Created October 11, 2016 16:16
Download Free O'Reilly eBooks
import requests
import re
from glob import glob # Google this. It's really good!
from os.path import basename, join # Basename removes the path part of a file, returning only the filename. Can also handle urls.
from concurrent.futures import ThreadPoolExecutor # For our concurrent downloads in download_many.
def get_urls(data, pattern):
urls = pattern.findall(data.text)
endings = ['.pdf', '.mobi', '.epub']
#!/usr/bin/env python3
from html.parser import HTMLParser
import requests
class MyHTMLParser(HTMLParser):
book_title = ""
start_title_check = False
grab_book_title = False
def handle_starttag(self, tag, attrs):