Skip to content

Instantly share code, notes, and snippets.

parse_git_branch() {
branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'`
if [ "${branch}x" != "x" ]; then
echo -n "$branch"
if [ `git st | grep -c 'Changes'` -ge 1 ] ; then echo -n ' * ' ; fi
fi
}
export PS1="\h\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\]> "
@taf2
taf2 / nginx-openresty
Created July 17, 2019 18:35
build openresty with ngx_cache_purge
# Installation of Openresty (Nginx + modules)
# Prepare with install some required packages
sudo apt-get install gcc make perl libpcre3-dev libssl-dev libreadline-dev libncurses5-dev libpcre3-dev libssl-dev libxslt-dev libgeoip-dev
# Add the Nginx user that will be used to run the daemon
sudo adduser --system --no-create-home --disabled-login --disabled-password --group nginx
# Go into /tmp folder for download and compiling Nginx
mkdir -p /tmp/nginx && cd /tmp/nginx
@taf2
taf2 / geo-load-custom.html
Created March 12, 2019 15:03
geo load custom GEO data for CTM code
<html>
<head>
<script src="//tracking-host.co/f.js"></script>
<script>
fetch("/your-own-geo.json").then(function(r) { r.toJSON().then(function(geo) {
__ctm.config.code = geo.area_code; // 410, 954, etc...
__ctm.config.region = geo.region; // MD, CA, etc..
__ctm.config.country = geo.country; // US, GB, etc...
__ctm.main.start(document.getElementById("phone")); // start and only replace within phone element or leave blank to swap whole document.
});
/*
Copyright 2018 CallTrackingMetrics
Integrating phone calls with openweathermap.org.
*/
function KelvinToFahrenheit(kelvin) {
return Math.round(((9/5) * kelvin) - 459.67);
}
@taf2
taf2 / curb-0.9.2.sample.output
Last active January 25, 2019 17:22
using netstat to check for open connections while running requests
ruby t.rb
ruby: 2.1.5, linux: Linux ip-10-55-11-11 4.14.67-66.56.amzn1.x86_64 #1 SMP Tue Sep 4 22:03:21 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
connections open: 1
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
connections open: 2
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
@taf2
taf2 / action.js
Last active August 24, 2018 19:44
panoply.io Integration to send call data to panoply.io
/*
panoply.io send data about phone calls, text messages, web forms and more to panoply.io.
USAGE:
Step 1:
Add to https://app.calltrackingmetrics.com/lambdas/new
Name your function panoply.io
Step 2:
@taf2
taf2 / github.com.failure
Created April 16, 2018 17:38
github internal ab testing failure?
taf2~/work/ctm (master $>)> git push
Counting objects: 15, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (15/15), done.
Writing objects: 100% (15/15), 2.88 KiB | 2.88 MiB/s, done.
Total 15 (delta 13), reused 0 (delta 0)
remote: Resolving deltas: 100% (13/13), completed with 13 local objects.
remote: /data/github/releases/deploy-b/vendor/gems/2.4.2/ruby/2.4.0/gems/statsd-ruby-0.3.0.github.3.38.gd478cc7/lib/github/statsd.rb:23:in `ip': getaddrinfo: Name or service not known (SocketError)
remote: from /data/github/releases/deploy-b/vendor/gems/2.4.2/ruby/2.4.0/gems/statsd-ruby-0.3.0.github.3.38.gd478cc7/lib/github/statsd.rb:23:in `initialize'
remote: from /data/github/releases/deploy-b/vendor/gems/2.4.2/ruby/2.4.0/gems/statsd-ruby-0.3.0.github.3.38.gd478cc7/lib/github/statsd.rb:106:in `new'
@taf2
taf2 / action.js
Last active August 14, 2019 18:01
Check the Weather Check the weather by entering a zip code.
/*
Copyright 2018 CallTrackingMetrics
Integrating phone calls with openweathermap.org.
*/
function KelvinToFahrenheit(kelvin) {
return Math.round(((9/5) * kelvin) - 459.67);
}
<p>Place Your Target Number Here</p>
<script type="text/javascript" src="//static.parastorage.com/services/js-sdk/1.83.0/js/wix.min.js"></script>
<script src="//static.parastorage.com/services/third-party/react/15.3.1/react-with-addons.min.js"></script>
<script src="//static.parastorage.com/services/third-party/react/15.3.1/react-dom.min.js"></script>
<script src="//static.parastorage.com/services/third-party/jquery/3.1.1/dist/jquery.min.js"></script>
<script src="//static.parastorage.com/services/third-party/lodash/4.17.2/lodash.js"></script>
<script src="//static.parastorage.com/services/js-sdk/1.81.0/js/wix.min.js"></script>
<script src="//static.parastorage.com/services/editor-ui-lib/1.26.0/lib/editor-ui-lib.min.js"></script>
<script>
// this will run as our code is loaded and available allowing you to customize how the script runs
@taf2
taf2 / example.html
Created November 13, 2017 21:26
Example FormReactor embed code
<!doctype html>
<html>
<head>
<style>
input[type=submit],
label { display:block; }
</style>
<!-- the tracing code typically using your tracking code found under Numbers -> Tracking Code -->
<script async src="//18614.ctmbizapp.co:8080/t.js"></script>
<title>FooBar Form Test Site</title>