Skip to content

Instantly share code, notes, and snippets.

View thefinn93's full-sized avatar

Finn thefinn93

View GitHub Profile
@thefinn93
thefinn93 / iptables.rule
Last active March 12, 2022 00:32
Finn's Amazing iptables Thing
# /etc/iptables.rules remove this line
*filter
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i enp5s0 -j DROP
-A FORWARD -i enp5s0 -p udp -m udp --dport 34197 -m state --state NEW -j ACCEPT
COMMIT
@thefinn93
thefinn93 / dblog.py
Created November 10, 2016 08:22
Weechat database logging script. Requirements: dataset and a driver to connect to your database.
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Finn Herzfeld <finn@finn.io>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
$ node_modules/.bin/npm install vorbis
> ogg@1.2.5 install /tmp/oggtest/node_modules/ogg
> node-gyp rebuild
make: Entering directory '/tmp/oggtest/node_modules/ogg/build'
CC(target) Release/obj.target/libogg/deps/libogg/src/framing.o
CC(target) Release/obj.target/libogg/deps/libogg/src/bitwise.o
AR(target) Release/obj.target/deps/libogg/ogg.a
COPY Release/ogg.a
@thefinn93
thefinn93 / node-debug.log
Created October 5, 2016 01:08
issues from installing node-vorbis
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/tmp/oggtest/node_modules/.bin/npm',
1 verbose cli 'install',
1 verbose cli 'vorbis' ]
2 info using npm@3.10.8
3 info using node@v6.7.0
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readLocalPackageData
finn@wash  /tmp/oggtest  npm install vorbis
npm WARN package.json oggtest@1.0.0 No description
npm WARN package.json oggtest@1.0.0 No repository field.
npm WARN package.json oggtest@1.0.0 No README data
-
> ogg@1.2.5 install /tmp/oggtest/node_modules/vorbis/node_modules/ogg
> node-gyp rebuild
make: Entering directory '/tmp/oggtest/node_modules/vorbis/node_modules/ogg/build'
CC(target) Release/obj.target/libogg/deps/libogg/src/framing.o
---
# Playbook for SeaGL webserver
- hosts: all
roles:
- base
- tools
- security
- server
- role: letsencrypt
letsencrypt_webroot_path: /var/www/html

Pretending to be the non-free billing app

FusionPBX doesn't do billing or LCR out of the box, but one guy will sell you closed, proprietary, non-free billing and LCR modules that will integrate nicely into FusionPBX. To help with this, there are a number of places in the free FusionPBX codebase that run things that these non-free apps need. Obviously these are all completely undocumented, until now.

These work by checking for an app named "billing". Specifically, they look for the app_config.php file in the billing folder. The conditional usually looks like this:

@thefinn93
thefinn93 / exporter.py
Created May 4, 2015 23:52
Rivendell Exporter (and converter and ID3 tagger)
#!/usr/bin/env python
# Rivendell Exporter
# Copyright (C) 2015 Finn Herzfeld
#
# Rivendell Exporter is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Rivendell Exporter is distributed in the hope that it will be useful,
@thefinn93
thefinn93 / getAvailability.py
Created January 29, 2015 20:36
Check kimsufi's availability and emails you when they've got open slots. one argument, the sort code or identifier they use for the type of server. To get it, inspect their HTML, the <tr> has a property of data-ref with the value you need. It changes sometimes too
#!/usr/bin/env python
## Usage: ./getAvailability.py 150sk20
## Remember to fill in that shit down there first
import sys
import json
import requests
import time
import smtplib
SMTP_USERNAME = 'yep@lol.net'
@thefinn93
thefinn93 / dyndns.sh
Created January 7, 2015 06:40
Dynamic DNS Updater for Hurricane Electric with full v6 support and shit
#!/bin/bash
HOSTNAME=...
USERNAME=$HOSTNAME # Hurricane Electric expects the username to be the hostname
PASSWORD=...
DEVICE=eth0
SAVEFILE=/var/run/ddns-lastip
function update {