Skip to content

Instantly share code, notes, and snippets.


Lewis Cowles Lewiscowles1986

Block or report user

Report or block Lewiscowles1986

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
Lewiscowles1986 / script.js
Created May 20, 2018
Anonymous Upload images to Imgur V3 JS
View script.js
window.addEventListener('paste', function(e) {
function eventPreventDefault(e) {
function getClipboardData(e) {
return window.clipboardData || e.clipboardData;
Lewiscowles1986 /
Last active Mar 26, 2019
Replay against system to test stability

Utility to replay HTTP requests on a service

This utility helps replay a statistically significant number of HTTP requests against a service (serially) which are enough to give significance to two-decimal places.


replay-http {url} [{headers_path} {payload_path} {http_method}]


Lewiscowles1986 / adapter-passthrough
Last active Mar 11, 2019
Allows passthrough for bridges, wireless access-point's and range extenders
View adapter-passthrough
if [ "$EUID" -ne 0 ]
then echo "Must be root"
# Allow overriding from eth0 by passing in a single argument
Lewiscowles1986 /
Last active Mar 7, 2019
Lazy load from an intelligent place

Lazy Loading (the smart way)

  1. Not all times when we have a Team will we want a list of User's or, approvers
  2. When we select UserApprover entries we want it to be per-team where deleted is False
  3. When we select FinancialApprover entries we want it to be per-team where deleted is False
  4. We may wish to select both UserApprover and FinancialApprover entries for a Team

Data model (simplified)


Lewiscowles1986 /
Created Aug 21, 2017
Raspberry pi stretch allow dhcpcd5 with /etc/network/interfaces
#!/bin/sh -e
# This file belongs in /usr/lib/dhcpcd5/dhcpcd how you get it there is up to you
return [
[ "Angola", "AO" ],
[ "Antigua and Barbuda", "AG" ],
[ "Aruba", "AW" ],
[ "Bahamas", "BS" ],
[ "Belize", "BZ" ],
[ "Benin", "BJ" ],
[ "Botswana", "BW" ],
Lewiscowles1986 / login.js
Created Dec 1, 2018 preScript for logging in using username+password before running tests.
View login.js
module.exports = {
run(context) {
return context.runWithDriver((driver) => {
return driver.get(context.options.loginUrl)
.then(() => {
const webdriver = context.webdriver;
const until = webdriver.until;
const By = webdriver.By;
const userName = context.options.username || 'admin';
Lewiscowles1986 /
Last active Nov 24, 2018
Get IP of running docker container

Get docker container IP address by name


mkdir -p $HOME/bin
wget -O ~/bin/docker-container-ip
chmod +x ~/bin/docker-container-ip
Lewiscowles1986 / scroll-position-hide-fb.js
Created Oct 23, 2018
Hide / show element depending on scroll position
View scroll-position-hide-fb.js
(function(target, threshold, elem) {
listener = () => {
if (target.scrollY > threshold) { = 1;
} else { = 0;
Lewiscowles1986 / count-lines
Created Oct 7, 2018
Count lines in files
View count-lines
This utility allows you to count the number of lines in files
by default just .py files, but accepts command-line arguments.
This utility does miss files and folders beginning with '.'
so don't use them!
usage: {script} {path} [extensions] [exclude]
You can’t perform that action at this time.