Skip to content

Instantly share code, notes, and snippets.

Reed Kraft-Murphy RWJMurphy

Block or report user

Report or block RWJMurphy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@RWJMurphy
RWJMurphy / metabuzz.py
Created Mar 26, 2018
golf all the fizzbuzz
View metabuzz.py
from itertools import combinations as c
s = sorted
def a(m):return reduce(lambda x,y:(x[0]+2**y[0],x[1]+y[1]),m,(0,''))
def p(x):return [None]+[x for _,x in s([a(d) for r in range(len(x)) for d in c(enumerate(x), r+1)])]
def metabuzz(m):
n=s([(v,k) for k,v in m.items()])
return '''def o(i):return str(%r[k(i)] or i)
def k(n):return sum([(n%%v==0)<<i for i,v in enumerate(%r)])
print "\\n".join(map(o, range(1, 101)))'''%(p([v for _,v in n]),[k for k,_ in n])
@RWJMurphy
RWJMurphy / 2011-08-18_whmscripts_disabling_invoice_emails.md
Last active Jan 24, 2020
WHMScripts: Disabling invoice creation emails in WHMCS on a per-client basis
View 2011-08-18_whmscripts_disabling_invoice_emails.md

If you’re using WHMCS to manage your cPanel shared servers, this is probably a request that you’ve received a few times. You have clients that are set up to pay invoices automatically from their credit cards, and they’d rather not receive the “Invoice Created” or “Invoice Payment Reminder” emails every month.

Normally WHMCS only allows you to disable these emails globally but, by making use of the EmailPreSend action hook, we can set up a list of clients not to receive these.

To get started just download the following script, change the file extension to .php, edit it to set up the $client_ids and place it in your WHMCS /includes/hooks/ directory

Please note, this script doesn’t disable only the automatically sent invoice notification emails, but also blocks manual sending of these for the selected clients.

(originally posted at http://whmscripts.net/whmcs/2011/disabling-invoice-creation-emails-in-whmcs-on-a-per-client-basis/)

@RWJMurphy
RWJMurphy / delegate.py
Created Feb 10, 2017
python delegate class decorator
View delegate.py
"""A class decorator to enable classes to delegate to an attribute."""
def delegate(delegate_class, delegate_name):
"""
Delegating class decorator.
.. code-block:: python
class Location():
@RWJMurphy
RWJMurphy / mattermost_emoji_uploader.sh
Last active Dec 20, 2016
terrible bulk emoji uploader for mattermost. needs [`jq`](https://stedolan.github.io/jq/), [`jo`](https://github.com/jpmens/jo), GNU `parallel`, and `curl`
View mattermost_emoji_uploader.sh
#!/bin/bash
set -eu
MM_URL="https://mm.example.org"
API_URL="${MM_URL}/api/v3"
LOGIN_URL="${API_URL}/users/login"
USERS_ME_URL="${API_URL}/users/me"
ADD_EMOJI_URL="${API_URL}/emoji/create"
banner() {
View keybase.md

Keybase proof

I hereby claim:

  • I am RWJMurphy on github.
  • I am rwjkm (https://keybase.io/rwjkm) on keybase.
  • I have a public key whose fingerprint is 37AC 6F5F A997 56C4 499B DD4A 7AD3 A560 5779 5178

To claim this, I am signing this object:

@RWJMurphy
RWJMurphy / do_boot2.sh
Created Jun 20, 2016 — forked from leucos/do_boot2.sh
Bootstrap your DO infrastructure unsing Ansible without dynamic inventory (version for Ansible v2.0+ and DO API v2.0)
View do_boot2.sh
#!/bin/bash
#
# What is that
# ============
#
# This script will help you setting up your digital ocean
# infrastructure with Ansible v2.0+ and DO API v2
#
# Usually, when working with DO, one is supposed to use digital_ocean.py
# inventory file, and spin up instances in a playbook.
View composed.py
class Composed:
"""Composable class."""
def __init__(self, components=None):
self.__components = []
if components:
self.register_components(components)
def register_components(self, components):
for component in components:
View functional.sh
#!/bin/bash
function silent() {
"$@" >/dev/null 2>&1
}
function command_exists() {
silent hash "$@"
}
View gist:e84371bb08d2449e9987
#!/bin/bash
function test {
echo ${FOO:=$(curl https://gist.githubusercontent.com/RWJMurphy/ded51ead3b153364099a/raw/348c26370e90b6c77a08a2e8fb3258fa6f1a7426/gistfile1.txt)}
}
test
test
@RWJMurphy
RWJMurphy / dwarf_fortress.vim
Last active Aug 29, 2015
DF Init & Raw file syntax highlighting for vim - WIP
View dwarf_fortress.vim
if exists("b:current_syntax")
finish
endif
" # matches and keywords
" ## Tags
syntax cluster initTags contains=@initTagNames,initTagDelimiter,@initValues
syntax region initTag start=/\v\[/ end=/\v[\]\n]/ contains=@initTags
syntax match initTagDelimiter /\v:/ contained
You can’t perform that action at this time.