Skip to content

Instantly share code, notes, and snippets.

@mknecht
mknecht / freepbx-install-codecs-encoders.sh
Last active July 19, 2018 18:50 — forked from worldadventurer/freepbx-install-codecs-encoders.sh
FreePBX Install Codecs & Encoders: mpeg123, lame, ffmpeg, h264, g729
# Tested on Centos 6 x64
echo This will install some codecs and encoders.
read -rsp $'Press any key to continue OR CTRL-c to QUIT ...\n' -n1 key
# Update mpeg123 to newer version
echo This will tell you your current version of mpeg123 - note this
mpg123
echo Installing a newer version now:
cd
# OLD: wget https://sourceforge.net/projects/mpg123/files/mpg123/1.23.8/mpg123-1.23.8.tar.bz2/download -O mpg123-1.23.8.tar.bz2
@mknecht
mknecht / surface.js
Last active October 12, 2017 23:34 — forked from lilobase/surface.js
Uglfied version of lilobase's for a refactoring example
const boxes = [[2, 3, 4], [1, 1, 10]];
// Calculates the total surface area of a box.
function total(bs) {
var total = [];
for (var b of bs) {
sides = [b[0]*b[1], b[1]*b[2], b[2]*b[0]];
m = Math.min(sides[0], sides[1], sides[2]);
@mknecht
mknecht / switched.py
Created March 20, 2016 08:15
switched: A tool to recognize state changes in a command-line pipe.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
import sys
if sys.stdin.isatty():
print("""Outputs a line if the input changed.
@mknecht
mknecht / read_local_file.py
Created January 20, 2016 06:38
Python, Test Helper: Load a file from directory the caller is in
import codecs
import inspect
def read_local_file(filename):
"""Reads the file from the directory of the caller.
Example usage in ~/myproj/tests/test_web.py:
read_local_file("example-payload.json")
@mknecht
mknecht / pep8radius_checker.py
Last active September 18, 2015 07:43
pep8radius checker for captainhook
# Uses pep8radius to check the to be committed patch for PEP-8 errors.
#
# https://github.com/alexcouper/captainhook
# https://github.com/hayd/pep8radius
# https://www.python.org/dev/peps/pep-0008/
from .utils import bash
CHECK_NAME = 'pep8radius'
@mknecht
mknecht / franklin_trees_01.jpg
Last active August 29, 2015 14:06 — forked from deanmalmgren/franklin_trees_01.jpg
Monkeypatched the errors.
franklin_trees_01.jpg