Skip to content

Instantly share code, notes, and snippets.

View Lewiscowles1986's full-sized avatar
🤓

Lewis Cowles Lewiscowles1986

🤓
View GitHub Profile
@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 <[email protected]>" &
@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

@Lewiscowles1986
Lewiscowles1986 / nice-scroll-init.js
Created December 30, 2016 15:40
JQuery NiceScroll
/*
* Requirements for nicescroll
* //www.codesign2.co.uk/js/jquery-1.11.3.min.js
* //www.codesign2.co.uk/js/jquery.nicescroll.min.js
*/
!function($) {
window.CD2 = window.CD2 || {};
window.CD2.style = window.CD2.style || {};
$(function() {
@Lewiscowles1986
Lewiscowles1986 / CMakeLists.patch
Last active January 8, 2017 23:52
Compile Darwin Source Packages Xenial https://opensource.apple.com/tarballs/
Common subdirectories: llvmCore-3425.0.36/autoconf and llvm-core-orig/llvmCore-3425.0.36/autoconf
Common subdirectories: llvmCore-3425.0.36/bindings and llvm-core-orig/llvmCore-3425.0.36/bindings
Common subdirectories: llvmCore-3425.0.36/cmake and llvm-core-orig/llvmCore-3425.0.36/cmake
diff llvmCore-3425.0.36/CMakeLists.txt llvm-core-orig/llvmCore-3425.0.36/CMakeLists.txt
442,448c442,448
< add_lit_target(check-all
< "Running all regression tests"
< ${LLVM_LIT_TESTSUITES}
< PARAMS ${LLVM_LIT_PARAMS}
< DEPENDS ${LLVM_LIT_DEPENDS}
@Lewiscowles1986
Lewiscowles1986 / FindJemalloc.cmake
Created January 15, 2017 16:35
Find Jemalloc library (CMake)
#
# Find the JEMALLOC client includes and library
#
# This module defines
# JEMALLOC_INCLUDE_DIR, where to find jemalloc.h
# JEMALLOC_LIBRARIES, the libraries to link against
# JEMALLOC_FOUND, if false, you cannot build anything that requires JEMALLOC
# also defined, but not for general use are
@Lewiscowles1986
Lewiscowles1986 / README.md
Last active May 14, 2018 22:27
get media folder length (HH:MM:SS.MS) python

Media Length Utility

Simple wrapper around ffbrobe system utility to allow scanning current folder for total media duration

Currently tested with .mp4, .avi & .mkv could expand to any file with mime-type .startswith('video/') check

Would be nice to have it cycle through subfolders (hence move from listdir to scandir) to give a summary per sub-folder

Changelog

@Lewiscowles1986
Lewiscowles1986 / google-trusted-stores.md
Last active February 10, 2017 10:59
Google Trusted stores crap
@Lewiscowles1986
Lewiscowles1986 / ssl-vhost-soslug.conf
Created February 12, 2017 21:19
Apache2.2 LetsEncrypt For SOSLUG
<VirtualHost _default_:443>
DocumentRoot /var/www/vhosts/soslug.org
ServerName www.soslug.org:443
ServerAlias soslug.org:443
SSLEngine on
SSLProtocol all -SSLv3 -SSLv2
SSLHonorCipherOrder on
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4
@Lewiscowles1986
Lewiscowles1986 / ssl-vhost-soslug
Last active February 12, 2017 22:08
Nginx 1.4.6 SSL Setup for SOSLUG
server {
listen 443 ssl spdy;
server_name soslug.org www.soslug.org;
ssl on;
ssl_certificate /etc/letsencrypt/live/soslug.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/soslug.org/privkey.pem
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";