Skip to content

Instantly share code, notes, and snippets.

View Lewiscowles1986's full-sized avatar
🤓

Lewis Cowles Lewiscowles1986

🤓
View GitHub Profile
#!/bin/bash
sudo tar -xzf ~/Downloads/VSCodium-linux-x64*.tar.gz -C . && rm ~/Downloads/VSCodium-linux-x64*
@Lewiscowles1986
Lewiscowles1986 / Build and push to dockerhub
Created April 7, 2020 16:20
Build and push to dockerhub
name: Docker Image CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
@Lewiscowles1986
Lewiscowles1986 / math_spelunk.c
Created March 3, 2020 22:45
Spelunking through math.h to try to find understanding
#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)
@Lewiscowles1986
Lewiscowles1986 / fullstory-org-code-js-input-helper.part.html
Created December 26, 2019 12:50
FullStory Org Code JS Input Helper
<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) {
@Lewiscowles1986
Lewiscowles1986 / script.js
Last active November 10, 2019 10:03
Prev Next JS injection
/*
* Used via https://chrome.google.com/webstore/detail/user-javascript-and-css/nbhcbdghjpllgmfilhnhkllmkecfmpld
* to embed JS in all web-pages that are compliant to enable keyboard-navigation of blog posts
*/
(function() {
window.addEventListener('keydown', function(e) {
switch(e.key) {
case 'Left': // IE11 BS
case 'ArrowLeft':
var link = document.querySelector('a[rel="prev"], .prev, #previtem');
@Lewiscowles1986
Lewiscowles1986 / .bashrc
Created November 9, 2019 21:36
vscode-as-editor
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 / rPi3-php7-setup.sh
Last active November 8, 2019 00:17
Raspberry Pi PHP7, Nginx 1.9 Installer
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Must be root"
exit
fi
apt-get update -y
apt-get upgrade -y
apt-get dist-upgrade -y
@Lewiscowles1986
Lewiscowles1986 / redirection.function.php
Last active October 24, 2019 07:25
PHP Redirect PHP, JS, HTML Meta Tag
<?php
const OPTION_DEFAULTS = [
'lang' => 'en',
'meta' => true,
'js' => true,
'title' => 'Redirection notice',
'link_sentence' => 'If you are not redirected automatically, follow <a href="%s">%s</a>',
'link_label' => 'this link',
'head_extra' => '<link rel="stylesheet" href="/css/style.css" />',
@Lewiscowles1986
Lewiscowles1986 / ra-7601U-USB-build-inst.sh
Last active September 3, 2019 23:31
install ralink 7601U USB N+150 wireless driver (Ubuntu 14.04 or Kernel 3.13+)
#!/bin/sh
#setup dependencies
sudo apt-get install --reinstall linux-headers-generic build-essential
#get patched drivers
wget http://www.lewiscowles.co.uk/dls/MT7601U-14.04-patched.tar -O - | tar -x
cd MT7601U-14.04-patched
# build and install
@Lewiscowles1986
Lewiscowles1986 / README.md
Last active March 26, 2019 18:47
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.

Usage

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

Parameters