This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime, date | |
import calendar | |
def monthdiff(start_period, end_period, decimal_places = 2): | |
if start_period > end_period: | |
raise Exception('Start is after end') | |
if start_period.year == end_period.year and start_period.month == end_period.month: | |
days_in_month = calendar.monthrange(start_period.year, start_period.month)[1] | |
days_to_charge = end_period.day - start_period.day+1 | |
diff = round(float(days_to_charge)/float(days_in_month), decimal_places) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This code comes from https://gist.github.com/oliveratgithub/ | |
-- Open in AppleScript Editor and save as Application | |
-- ------------------------------------------------------------ | |
--this is required to break the filename into pieces (separate name and extension) | |
set text item delimiters to "." | |
tell application "Finder" | |
set all_files to every item of (choose file with prompt "Choose the Files you'd like to rename:" with multiple selections allowed) as list | |
--now we start looping through all selected files. 'index' is our counter that we initially set to 1 and then count up with every file. | |
--the 'index' number is of course required for the sequential renaming of our files! | |
repeat with index from 1 to the count of all_files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$phones = `asterisk -rx 'sip show peers'`; | |
$lines = explode("\n", $phones); | |
foreach ($lines as $line) { | |
$segments = preg_split("/\s+/", $line); | |
if (count($segments)>1) { | |
if ($segments[1]!="(Unspecified)") { | |
$parts = explode("/", $segments[0]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$phones = `asterisk -rx 'sip show peers'`; | |
$tenant=array(); | |
$lines = explode("\n", $phones); | |
foreach ($lines as $line) { | |
$segments = preg_split("/\s+/", $line); | |
if (count($segments)>1) { | |
if ($segments[1]!="(Unspecified)") { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
""" | |
Ever wanted to record audio using Dante Virtual Soundcard in Reaper? | |
Wanted to set up a project with 64 tracks, mapped to each of the 64 inputs | |
and also to the 64 Dante outputs? | |
Thought that it would take too long by hand? | |
This script generates the XML for 64 tracks with output maps suitable | |
for use in this application. IT's not a whole Reaper Project file, but rather | |
the "track" definitions which you can copy/paste into a reaper file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Nova Password retrieval for OpenStack | |
This utility allows you to retrieve a password (using the method made available by | |
openstack-novaclient) for a Virtual machine from your CLI. | |
openstack client (python-openstackclient) does not currently include the | |
`get password` option that is present in the `openstack-novaclient` utility. | |
The openstack-novaclient does not include the ability to use openstack clouds as a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
### | |
### An implementation of Nathan W. Pyle's Ghostname | |
### https://www.facebook.com/nathanwpyle2/posts/405022030992924 | |
### https://twitter.com/nathanwpyle/status/1437233812203782145 | |
### | |
name = input("Enter your name: ") | |
outname = "" | |
for l in name: |