Skip to content

Instantly share code, notes, and snippets.

View jfinstrom's full-sized avatar
💭
making stuff

James Finstrom jfinstrom

💭
making stuff
View GitHub Profile
@jfinstrom
jfinstrom / backup_hook.py
Created October 6, 2014 22:01
FreePBX backup hook script...
#!/usr/bin/env python
#
# Usage: backup_hook.py <id>
#
import requests
import sys
import base64
import tempfile
hookurl = ''
TMPDIR = tempfile.gettempdir()
@jfinstrom
jfinstrom / hctest.py
Created January 7, 2015 00:05
HypChat Send message to room
#!/usr/bin/env python
from hypchat import HypChat
hc = HypChat("KEY")
room = hc.get_room('ROOMNAME')
room.message('Hello World', "green")
@jfinstrom
jfinstrom / source-TrueCNAM.module
Last active August 14, 2024 13:15
FreePBX CallerID Superfecta module for TrueCNAM
<?php
/**
* TrueCNAM module
* Service Details at http://truecnam.com/products
* Free Users get 2 lookups/minute 25/hour as of this note. Visit site for latest info
* Copyright (C) 2015 Sangoma Technologies
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@jfinstrom
jfinstrom / mxmlupdate.py
Created June 19, 2015 19:33
updates module xml version and adds change log entry
#!/usr/bin/env python
import sys
import xml.etree.ElementTree as ET
from distutils.version import LooseVersion
bumped = False
tree = ET.parse(sys.argv[1])
root = tree.getroot()
@jfinstrom
jfinstrom / cdrcsv.php
Last active October 7, 2015 13:55
Last 30 days of CDR as CSV with FreePBX bootstrap
#!/usr/bin/env php
<?php
if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) {
include_once('/etc/asterisk/freepbx.conf');
}
$outfile = '/tmp/report.csv';
$dbh = \FreePBX::Database();
$sql = "SELECT * FROM asteriskcdrdb.cdr WHERE date(calldate) >= date(now()-interval 30 day);";
$stmt = $dbh->prepare($sql);
$stmt->execute();
@jfinstrom
jfinstrom / parsemodxml.py
Created September 25, 2015 21:47
Parsing module xml in python
#!/usr/bin/env python
import sys
import xml.etree.ElementTree as ET
tree = ET.parse(sys.argv[1])
root = tree.getroot()
version = root.find('version').text
description = root.find('description').text
@jfinstrom
jfinstrom / genreadme.php
Created September 25, 2015 22:41
Generates readme ala PHP
#!/usr/bin/php
<?php
if (file_exists($argv[1])) {
$modinfo = simplexml_load_file($argv[1]);
}else{
exit;
}
$name = (string) $modinfo->name;
$description = (string) $modinfo->description;
@jfinstrom
jfinstrom / flashall.sh
Created October 21, 2015 03:50
modified edison flash script
#!/bin/bash
BACKUP_IFS=$IFS
IFS=$(echo -en "\n\b")
GETOPTS="$(which getopt)"
if [[ "$OSTYPE" == "darwin"* ]] ; then READLINK=greadlink; GETOPTS="$(brew list gnu-getopt | grep bin/getopt)"; else READLINK=readlink;fi;
if [[ "$OSTYPE" == "cygwin" ]] ;
@jfinstrom
jfinstrom / source-Voip_Assylum.module
Last active November 19, 2015 22:56
Voip Assylum superfecta source
<?php
/**
* Copyright (c) 2015 "James Finstrom"
*
* This is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
@jfinstrom
jfinstrom / echo.sh
Last active April 30, 2020 00:39
prints out the first argument
#!/bin/bash
echo "BY USING THIS SCRIPT, YOU AGREE TO ASSUME ALL RESPONSIBILITY"
echo "FOR USE OF THE PROGRAM INCLUDED IN THIS INSTALLATION. NO WARRANTIES"
echo "EXPRESS OR IMPLIED INCLUDING MERCHANTABILITY AND FITNESS FOR PARTICULAR"
echo "USE ARE PROVIDED. YOU ASSUME ALL RISKS KNOWN AND UNKNOWN AND AGREE TO"
echo "HOLD GOATS, CHICKENS, PHIL FROM THE 3RD FLOOR, AND THE ENTIRE"
echo "WORLD HARMLESS FROM ANY AND ALL LOSS OR DAMAGE"
echo "WHICH RESULTS FROM YOUR USE OF THIS SOFTWARE. IF ANY OF THESE TERMS"
echo "AND CONDITIONS ARE RULED TO BE UNENFORCEABLE, YOU AGREE TO ACCEPT ONE"
echo "DOLLAR IN U.S. CURRENCY AS COMPENSATORY AND PUNITIVE LIQUIDATED DAMAGES"