Skip to content

Instantly share code, notes, and snippets.

View tekwiz's full-sized avatar

Travis D. Warlick, Jr. tekwiz

View GitHub Profile
@tekwiz
tekwiz / post-message-logger.js
Created July 24, 2024 19:43
Log messages sent/received
window.addEventListener('message', function MessageLogger (o) {
console.debug('Message Origin:%s Data:%o', o.origin, o.data);
});
window.__postMessage = Window.prototype.postMessage;
Window.prototype.postMessage = function _postMessage () {
console.debug('PostMessage %o', Array.from(arguments));
window.__postMessage.apply(this, arguments);
};
@tekwiz
tekwiz / README.md
Created January 9, 2021 17:08
Node.js `debuglog` sections

Node.js [debuglog()][util-debuglog] sections

Available for NODE_DEBUG in [node.js master as of 2021 Jan 9][nodejs-head-20210109]:

  • esm
  • http
  • http2
  • https
  • module
  • net
@tekwiz
tekwiz / README.md
Last active March 6, 2018 17:09
Web Font Conversion

Woff2

https://github.com/google/woff2

brew install brotli
curl -L -o /usr/local/src/woff2-1.0.2.tar.gz https://github.com/google/woff2/archive/v1.0.2.tar.gz
tar -C /usr/local/src -xzvf /usr/local/src/woff2-1.0.2.tar.gz
mkdir -vp /usr/local/src/woff2-1.0.2/out
cd /usr/local/src/woff2-1.0.2/out
@tekwiz
tekwiz / update-clock.sh
Created April 11, 2017 17:48
Update clock (raspberry pi)
#!/bin/bash
SERVICE_TIMEOUT=5 # seconds
NTP_SERVER=time.nist.gov
NTPD_PIDFILE=/var/run/ntpd.pid
log() {
[ $# -lt 2 ] && echo "Invalid call to log(): too few arguments" 1>&2 && exit 1
local lev="$1" ; shift
local fmt="$1\n" ; shift
@tekwiz
tekwiz / 00-README.md
Last active December 30, 2016 16:13
Node.js 6 global console scope issue

Node.js 6 global console scope issue

The assignment to console.debug on console-scope-test.js:13 seems to be overriding the assignment on console-scope-test2.js:9, but the strict-equals assertions seem inconsistent.

Run:

NODE_DEBUG=scope1,scope2 node console-scope-test.js

Outputs:

#!/bin/bash
group_name='<log-group-name>'
start_seconds_ago=3600
aws_cmd_opts= # e.g. "--profile <profile-name>"
# Usage: get_loglines "<log-group-name>" <start-time>
get_loglines() {
aws $aws_cmd_opts --output text logs filter-log-events \
--log-group-name "$1" \
@tekwiz
tekwiz / create_USB-CentOS_6.6.sh
Last active August 29, 2015 14:16
Create CentOS 6.6 Bootable USB Installer
#!/bin/bash
###
# Download the ISO if not already done:
# curl -o ~/Downloads/CentOS-6.6-x86_64-minimal.iso \
# http://mirror.lug.udel.edu/pub/centos/6.6/isos/x86_64/CentOS-6.6-x86_64-minimal.iso
#
# Verify the ISO:
# iso_sha256=` openssl sha256 -r ~/Downloads/CentOS-6.6-x86_64-minimal.iso | cut -d ' ' -f1`
# [[ $iso_sha256 != '5458f357e8a55e3a866dd856896c7e0ac88e7f9220a3dd74c58a3b0acede8e4d' ]] && echo "BAD: SHA256 is incorrect!" 1>&2
@tekwiz
tekwiz / excerpts.nginx.access.log.md
Last active August 29, 2015 14:06
PRNOCv3 failover server tests

blpv0326.enaf.bhdc.att.com: Nginx access.log

98.92.214.10 - - [16/Sep/2014:15:49:20 -0500] "GET / HTTP/1.1" 444 0 "-" "Mozilla/5.0 (iPad; CPU OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53"

blpv0327.enaf.bhdc.att.com: Nginx access.log

98.92.214.10 - - [16/Sep/2014:15:50:33 -0500] "GET / HTTP/1.1" 444 0 "-" "Mozilla/5.0 (iPad; CPU OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53"
@tekwiz
tekwiz / trello-filter.xml
Last active August 29, 2015 14:04
GMail Trello Filter
<?xml version='1.0' encoding='UTF-8' ?>
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:apps='http://schemas.google.com/apps/2006'>
<title>Mail Filters</title>
<entry>
<category term='filter'></category>
<title>Mail Filter</title>
<content></content>
<apps:property name='from' value='trello.com'/>
@tekwiz
tekwiz / ssh-tunnel
Last active August 29, 2015 14:03
ssh-tunnel command
#!/usr/bin/env ruby
require "optparse"
require "ostruct"
$options = OpenStruct.new
$options.verbose = false
$options.local_port = nil
$opts = OptionParser.new do |o|