Skip to content

Instantly share code, notes, and snippets.

View ginkgomzd's full-sized avatar

Michael Z Daryabeygi ginkgomzd

View GitHub Profile
@ginkgomzd
ginkgomzd / mock-post-back
Created February 6, 2019 15:01
CiviCRM Mock Authorize.net IPN Postback
#!/bin/bash
# for development, you can go bare-metal with this URL:
# no payment processor ID necessary:
# THE_URL=http://awesome.org/sites/all/modules/civicrm/extern/authorizeIPN.php
# Confirm the URL to use in the Authorize.net Silent-Post URL:
# last URL segment is the payment processor ID
THE_URL="https://awesome.org/civicrm/payment/ipn/1"
@ginkgomzd
ginkgomzd / confirm Authorize.net Silent-Post URL
Last active September 10, 2018 22:02
cURL script that can be used to confirm the Silect-Post URL to configure in your Authorize.net account.
#!/bin/bash
# for development, you can go bare-metal with this URL:
# no payment processor ID necessary:
# THE_URL=http://awesome.org/sites/all/modules/civicrm/extern/authorizeIPN.php
# Confirm the URL to use in the Authorize.net Silent-Post URL:
# last URL segment is the payment processor ID
THE_URL="https://awesome.org/civicrm/payment/ipn/1"
@ginkgomzd
ginkgomzd / block-web
Created September 5, 2018 15:52
block websites so you can get shyte done
#!/bin/sh
DOMAINS="www.facebook.com twitter.com www.instagram.com"
UNTIL=90 #minutes
for d in $DOMAINS
do
sudo iptables -I OUTPUT -d $d -j DROP
done
@ginkgomzd
ginkgomzd / civimail-template-diffs
Last active April 1, 2018 20:27 — forked from axon-obriend/civimail-template-diffs
Compare any modified CiviCRM workflow templates to the originals
#!/usr/bin/env bash
DIR_DEFAULTS="./tmp.default"
DIR_MODIFIEDS="./tmp.modified"
test -d "$DIR_DEFAULTS" && echo "ERROR: $DIR_DEFAULTS would be deleted" && exit 1
mkdir "$DIR_DEFAULTS"
test -d "$DIR_MODIFIEDS" && echo "ERROR: $DIR_DEFAULTS would be deleted" && exit 1
mkdir "$DIR_MODIFIEDS"
@ginkgomzd
ginkgomzd / run-every
Last active September 27, 2018 16:42
poormans live-reload, or whatever, over and over and over
#!/usr/bin/env bash
# This is a gist
# https://gist.github.com/ginkgomzd/050d1452709d5a7cddbd802e0c8087a3
run-every() {
boldtxt=$(tput bold)
normaltxt=$(tput sgr0)
@ginkgomzd
ginkgomzd / gen-pass.sh
Last active February 5, 2021 02:48
generate a strong password without string delimiters in it
#!/usr/bin/env bash
# generate a strong password without shell special characters
# defaults to 32 characters, overridden to a number passed as first arg
# uses xclip to copy to clipboard
# uses zenity to alert to desktop (from gnome-run-prompt)
gen_pass_length=32
if [ $# -eq 1 ]; then
gen_pass_length="$1"
#
# Invoke from cordova project root
# Locates the apk, detects the package name, uninstalls it before installing.
# Starts the app using `adb shell am...`
#
adbinst() {
apk=`find . -name android-debug.apk`
platforms=`find . -maxdepth 1 -type d -name platforms`
if [ "$platforms" != './platforms' ] ; then echo "NOT IN PROJECT DIR"; return; fi
@ginkgomzd
ginkgomzd / sp_add_column_if_not_exists.sql
Last active June 19, 2017 23:53
MySQL Conditional Alter Table Add Column
DROP PROCEDURE IF EXISTS `sp_add_column_if_not_exists`;
DELIMITER !!
CREATE PROCEDURE sp_add_column_if_not_exists (
IN table_name nvarchar(128),
IN column_name nvarchar(128),
IN column_definition varchar(256)
)
@ginkgomzd
ginkgomzd / List Enabled Error Reporting Flags.php
Last active June 16, 2017 20:02
Test or List PHP Error Reporting Flags
<?php
// example call, specifying bit-flags,
// returns as string:
echo listEnabledErrorReportingFlags(E_ALL & ~(E_WARNING|E_NOTICE|E_STRICT));
// example call, using current bit-flags,
// returns as array:
var_export(listEnabledErrorReportingFlags(null, TRUE));
@ginkgomzd
ginkgomzd / ansible-router
Last active June 3, 2017 19:59
make ansible appear as one command
#! /usr/bin/env bash
__print_completions() {
printf '%s\n' "${COMPREPLY[@]}"
}
# load bash-completion functions
source /etc/bash_completion
_ansible_wrapper() {