This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -ue | |
# Modified "CIDR to IP range" function taken from https://stackoverflow.com/a/18120519/213983 | |
# use like `cidr_iter "192.168.1.1/24"` | |
cidr_iter() { | |
# create array containing network address and subnet | |
local network=(${1//\// }) | |
# split network address by dot | |
local iparr=(${network[0]//./ }) | |
# if no mask given it's the same as /32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Spacing helpers for consistent margin and padding on elements. Uses rems (not px!) | |
* | |
* With the current default settings, generates classes like: | |
* .mts = margin-top: 0.5rem | |
* .phl = padding-left: 2rem; padding-right: 2rem; // h = horizontal = left/right | |
* | |
* Inspired by: | |
* https://github.com/mrmrs/css-spacing | |
* https://getbootstrap.com/docs/4.0/utilities/spacing/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# what's more frustrating than using `screen` to a serial console then running `less` or `vim` and having it | |
# not use your full window width & height like a NORMAL ***ING TERMINAL EMULATOR | |
# this belongs in /etc/systemd/system/serial-getty\@ttyS0.service.d/override.conf | |
# If your terminal is something other ttyS0, adjust as needed. | |
# This is for Systemd (Debian Jessie and above, ubuntu Xenial/ Zesty, etc. | |
# There's a non-systemd equivalent in /etc/login.defs I think | |
[Service] | |
Environment="TERM=linux" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const chromedriver = require('chromedriver'); | |
const retry = require('p-retry'); | |
const http = require('axios'); | |
/** | |
* Start chromedriver and waits for it to become available before the tests start. | |
* Call this on wdio.confg `onPrepare`, passing `this` (the wdio config) | |
*/ | |
function start(config) { | |
const pollUrl = `http://${config.host || 'localhost'}:${config.port || 4444}${config.path || '/wd/hub'}/status`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Re: http://jlongster.com/Two-Weird-Tricks-with-Redux specifically James' comment on having to wait on an action: | |
* | |
* redux-thunk returns whatever value is returned by my action. In this case I'm using axios so it already returns a promise. | |
* So if I want to do something after an async action completes (without having to go through the redux store that gets | |
* updated by some sort of ACTION_DONE state) I can just `.then()` on the promise returned by my action creator. | |
* | |
* Example follows: | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
├── [email protected] | |
├─┬ [email protected] | |
│ ├─┬ [email protected] | |
│ │ └── [email protected] | |
│ ├── [email protected] | |
│ ├── [email protected] | |
│ ├─┬ [email protected] | |
│ │ ├─┬ [email protected] | |
│ │ │ └── [email protected] | |
│ │ └── [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-env jasmine */ | |
beforeEach(function() { | |
jasmine.addMatchers({ | |
toBeInstanceOf: (util, customEqualityTesters) => { | |
return { | |
compare: (actual, expected) => { | |
const pass = (actual instanceof expected); | |
return { | |
pass, | |
message: `Expected ${actual} to ${pass ? 'not' : ''} be instance of ${expected}`, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#require 'rack/request' | |
# Rack middleware to decode a `Transfer-Encoding: chunked` HTTP request. | |
# | |
# USAGE NOTE: | |
# | |
# Some HTTP servers (Webrick and Unicorn/Rabinbows/Zbatery) already decode the | |
# chunked stream, but they leave the 'Transfer-Encoding' header and don't bother | |
# to add a 'Content-Length' header, which causes rails ActionDispatch::Request | |
# to not parse the whole request body. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Some things taken from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# Set the colours you can use | |
black='\033[0;30m' | |
white='\033[0;37m' | |
red='\033[0;31m' | |
green='\033[0;32m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# shellshock upgrade & patch for Mac OSX | |
# OSX ships with a horribly old version of bash (3.2) which is vulnerable to | |
# the Shellshock exploit (CVE-2014-6271) | |
# We use homebrew to get a recent version of bash, then symlink it to | |
# /bin/bash and /bin/sh (because sh is really bash) | |
# | |
# Use this to see if you're vulnerable | |
# env X="() { :;} ; echo vulnerable" /bin/bash -c "echo testing" | |
brew update && brew install bash |
NewerOlder