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
View install-vscodium-64-bit-update-after-download.sh
#!/bin/bash
sudo tar -xzf ~/Downloads/VSCodium-linux-x64*.tar.gz -C . && rm ~/Downloads/VSCodium-linux-x64*
View Build and push to dockerhub
name: Docker Image CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
@Lewiscowles1986
Lewiscowles1986 / math_spelunk.c
Created Mar 3, 2020
Spelunking through math.h to try to find understanding
View math_spelunk.c
#include<stdio.h>
#include<math.h>
#include <stdint.h>
#include <string.h>
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define for_endian(size) for (int i = 0; i < size; ++i)
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define for_endian(size) for (int i = size - 1; i >= 0; --i)
View fullstory-org-code-js-input-helper.part.html
<script type="text/javascript">
(function() {
/*
* Helper to extract FullStory Org code from URL when used in a HTML input element
*/
const SCHEME_INDICATOR = '://';
const URL_PATH_SEPARATOR = '/';
const FULLSTORY_DOMAIN_INDICATOR = 'app.fullstory.com';
document.querySelector('#fullstory_org_code').addEventListener('input', function(event) {
View .bashrc
export EDITOR="code --wait"
# export EDITOR="codium --wait"
# export EDITOR="atom --wait"
# export EDITOR="nano --wait"
# export EDITOR="vi --wait"
# export EDITOR="sublime --wait"
@Lewiscowles1986
Lewiscowles1986 / README.md
Last active Mar 26, 2019
Replay against system to test stability
View README.md

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.

Usage

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

Parameters

@Lewiscowles1986
Lewiscowles1986 / README.md
Last active Mar 7, 2019
Lazy load from an intelligent place
View README.md

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)

image

@Lewiscowles1986
Lewiscowles1986 / login.js
Created Dec 1, 2018
Sitespeed.io 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
Lewiscowles1986 / README.md
Last active Nov 24, 2018
Get IP of running docker container
View README.md

Get docker container IP address by name

Installation

mkdir -p $HOME/bin
wget -O ~/bin/docker-container-ip https://gist.github.com/Lewiscowles1986/2c80f1e510152b461eae5c501a00a195/raw/6b60245035ee63a025db20e287f89d74db08b356/docker-network-ip
chmod +x ~/bin/docker-container-ip
@Lewiscowles1986
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) {
elem.style.opacity = 1;
} else {
elem.style.opacity = 0;
}
};
target.addEventListener(
'scroll',
You can’t perform that action at this time.