Skip to content

Instantly share code, notes, and snippets.

View Lewiscowles1986's full-sized avatar
🤓

Lewis Cowles Lewiscowles1986

🤓
View GitHub Profile
@Lewiscowles1986
Lewiscowles1986 / migrate.sh
Created August 2, 2016 11:56
WordPress Migrate Site
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Must be root"
exit
fi
if[ $# -ne 3 ]; then
echo "Sorry, we need both the source site, and the destination site"
echo "Usage:"
@Lewiscowles1986
Lewiscowles1986 / lc-svg-upload.php
Last active August 4, 2016 13:45
SVG Media Plugin for WordPress (Works since 4.1.2!)
<?php
// Please see https://github.com/Lewiscowles1986/WordPressSVGPlugin from now on
@Lewiscowles1986
Lewiscowles1986 / checkout.py
Last active August 10, 2016 08:43
interview example in python
import copy
from items import CheckoutItem
from discounts import ItemDiscount
class Checkout(object):
def __init__(self):
self.items = {}
self.offers = []
@Lewiscowles1986
Lewiscowles1986 / jenkinsfile
Created October 20, 2016 13:18
PHP Jenkins Unit Test Pipeline Basic PHP-Ulid
node {
stage('Cleanup') {
sh 'rm -rf ./*'
}
stage('Fetch from GitHub') {
sh 'git clone https://github.com/Lewiscowles1986/ulid'
}
stage('Get Composer') {
sh 'wget -q http://getcomposer.org/download/1.2.1/composer.phar'
}
@Lewiscowles1986
Lewiscowles1986 / install.sh
Last active October 28, 2016 12:46
Install Go 1.7.3
#!/bin/bash
wget https://storage.googleapis.com/golang/go1.7.3.linux-amd64.tar.gz
tar -xvf go1.7.3.linux-amd64.tar.gz
sudo mv go /opt/go
sudo cat > /etc/profile.d/go.sh <<EOF
export GOROOT=/opt/go
export PATH=\$PATH:\$GOROOT/bin
EOF
@Lewiscowles1986
Lewiscowles1986 / merry-xmas.py
Created November 12, 2016 02:23
Merry Christmas PyGame
import pygame
import random
class Snowfield():
def __init__(self, density, speed, size, color, bounds, pygame, screen):
self.color = color
self.flakes = []
self.speed = speed
self.size = size
@Lewiscowles1986
Lewiscowles1986 / swagger.yaml
Created December 6, 2016 05:11
Useless Swagger - What I imagine most start off with
swagger: '2.0'
info:
title: Testing Swagger
description: This is a test repo
version: "1.0.0"
# the domain of the service
host: api.codesign2.co.uk
# array of all schemes that your API supports
schemes:
- https
@Lewiscowles1986
Lewiscowles1986 / etc-ssh-sshrc
Created December 13, 2016 13:21
Monitor SSH login to server
ip=`echo $SSH_CONNECTION | cut -d " " -f 1`
logger -t ssh-wrapper $USER login from $ip
echo "User $USER just logged in from $ip" | mail -s "SSH Login" "CD2 Team <codesign2@icloud.com>" &
@Lewiscowles1986
Lewiscowles1986 / better-AIO.php
Last active December 16, 2016 12:22
PHP Design notes
<?php
interface IdentifiableInterface {
public function identify() : string;
}
interface HashableInterface {
public function getHash(IdentifiableInterface $obj) : string;
}
@Lewiscowles1986
Lewiscowles1986 / usbloadergx_hdd.md
Created December 27, 2016 14:16 — forked from joshenders/usbloadergx_hdd.md
How to format a USB drive for storing GameCube games

Why do we change the cluster size when formatting USB drives for storing GameCube games?

For loading GC Games with USBLoaderGX via DiosMios/Nintendont, format your usb drive's primary partition as FAT32 with 32KB clusters (also known as blocks). This increases performance by reducing the NUMBER of transactions required to perform a read/write operation at the expense of the (very negligible) LENGTH of time to complete a transaction; since it's reading more data per transaction.

I'm not certain, since I can't find a GameCube disk specification, but I don't think the 32KB cluster size is an attempt to imitate the on-disk storage format of retail GameCube discs; which may or may not be 32KB. Retail Wii discs however, actually DO use 32KB clusters. As far as I can tell, 32KB is simply the highest density of bytes per cluster that is supported by FAT32 and of course, by extension, Wii homebrew storage libraries.

If you're concerned about storage efficiency