Skip to content

Instantly share code, notes, and snippets.

View moos3's full-sized avatar

Richard moos3

  • Boost Insurance
  • Maine, USA
  • X @moos3
View GitHub Profile
@moos3
moos3 / resolver.sls
Created April 2, 2014 16:58
SaltStack Resolver based off subnets
{% if S@10.50.50.0/24 %}
/etc/resolv.conf:
file.managed:
- source: salt://files/ca/etc/resolv.conf
{% elif S@172.16.0.0/16 or S@66.151.109.0/24 %}
/etc/resolv.conf:
file.managed:
@moos3
moos3 / archive-mails
Created December 18, 2013 14:55 — forked from pkern/archive-mails
#!/bin/sh
BASE=$HOME/Maildir
ARCHIVEBASE=$HOME/Maildir/archive.
for folder in `find $BASE -maxdepth 1 -type d \! -regex '.*/archive\..*' \! -name cur \! -name tmp \! -name new`
do
folder=$(basename $folder)
if [ "${folder}" = "Maildir" ]; then folder=INBOX; fi
./cleanup-maildir.py --archive-folder=${ARCHIVEBASE}${folder} --maildir-root=$BASE --folder-prefix= --age=365 -d 1 -k -u -v archive ${folder}
@moos3
moos3 / main.go
Last active March 27, 2019 14:38
on the fly image processing
package main
import (
"bytes"
"flag"
"fmt"
"image"
"image/draw"
"image/gif"
_ "image/jpeg"
#!/usr/local/bin/python
#
# process-rxfax.py - post process incoming fax from freeswitch (spandsp raw .tiff => pdf, then
# emailed)
#
# the script uses the UUID from freeswitch to make a unique filename on the server while receiving,
# then renames the attachment to a friendly name for the emailed user. The script calls tiff2ps
# and ps2pdf to create a PDF from the initial TIFF from spandsp.
#
import sys # import the sys module for argv
package main
import (
"bufio"
"fmt"
"log"
"net/http"
"os"
"time"
### Keybase proof
I hereby claim:
* I am moos3 on github.
* I am moos3 (https://keybase.io/moos3) on keybase.
* I have a public key ASCQxVDKDXqWOH-h1Z3cZP2ZkqtDRocc2phEGUy2Vl8TGwo
To claim this, I am signing this object:
@moos3
moos3 / mysql-replication-stats.sh
Created December 14, 2016 04:48 — forked from edmorley/mysql-replication-stats.sh
MySQL replication catch-up stats script
#!/usr/bin/env bash
# Updated/fixed version of the script from:
# https://www.percona.com/blog/2012/08/29/heres-a-quick-way-to-foresee-if-replication-slave-is-ever-going-to-catch-up-and-when/
delay=60
echo -e "Stats will be output every ${delay}s...\n"
cmd="mysql -e 'show slave status\G' | awk '/Seconds_Behind_Master/ { print \$2 }'"
while sleep $delay; do
       +--------------------------+
       |                          |
       |      AWS VPC VPN         |
       |      172.16.0.0/16       |
       +------------------+---^---+
                          |   |
ping 10.10.0.0/26 Fail    |   | 172.16.0.0/16 ping ok
                          |   |
                          |   |                                                               +----------------------------------------+
[21:03:12] <@[intra]lanman> moos3: ping
[21:03:27] bkw_1 (~brian@2001:470:1f0f:80d:bcd7:1136:a649:d571) left IRC. (Ping timeout: 252 seconds)
[21:03:33] <moos3> [intra]lanman whats up man
[21:03:42] <@[intra]lanman> how come you never told me about skydas?
[21:03:46] astan24 (~kvirc@206-248-138-147.dsl.teksavvy.com) joined the channel.
[21:03:46] <moos3> Ken said you was late and missed the presentation
[21:03:52] <@[intra]lanman> yeah :-(
[21:03:56] <moos3> [intra]lanman its a brand new conception
[21:05:24] <moos3> it started out just as a mod_callcenter operator panel and has grown from there based off what we needed to get done internally
[21:05:40] <moos3> I want to intergrate your dialplan bits in at somepoint
<?php
chdir(__DIR__);
require_once('./vendor/autoload.php');
// Put all Freeswitch functions and Settings here
require_once('./settings.inc');
require_once('./lib/freeswitch_lib.inc');
$app = new \Slim\Slim();
$app->view(new \JsonApiView());