Skip to content

Instantly share code, notes, and snippets.

View michaelbutler's full-sized avatar
💥
Reticulating splines...

Michael Butler michaelbutler

💥
Reticulating splines...
View GitHub Profile
@michaelbutler
michaelbutler / balance.scala
Last active July 21, 2017 22:01
solution for "count change" problem
def balance(chars: List[Char]): Boolean = {
def inner(chars: List[Char], sum: Int): Boolean = {
if (chars.isEmpty)
sum == 0
else {
val c = chars.head.toString()
var newSum = sum
if (c.equals("("))
newSum += 1
else if (c.equals(")"))
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1519158109">
<project timestamp="1519158109">
<package name="MyProj\One">
<file name="/Users/testuser/tmp/phpunit-issue-testing/src/One/One.php">
<class name="MyProj\One\One" namespace="MyProj\One">
<metrics complexity="5" methods="3" coveredmethods="1" conditionals="0" coveredconditionals="0" statements="8" coveredstatements="4" elements="11" coveredelements="5"/>
</class>
<line num="34" type="method" name="__construct" visibility="public" complexity="2" crap="2.06" count="1"/>
<line num="36" type="stmt" count="1"/>
@michaelbutler
michaelbutler / instructions.md
Created April 3, 2018 02:43
Guide to Intercept & Inspect SSL or HTTPS requests from an Android App Using a Free Emulator

This guide will take you from start to finish: how to inspect (intercept) SSL (or normal) web requests using Ubuntu 16.04 LTS (Linux). Everything in this guide is free and can be legally obtained.

Components:

  • Android Studio (comes with built in Emulator)
  • Burp Suite Community Edition
  • Terminal

Step 1: Install Android Studio

@michaelbutler
michaelbutler / guzzletest.php
Created March 13, 2019 02:47
This test script causes file descriptors to stay open until the process quits, even though the local variables all should be cleared out.
#!/usr/bin/php
<?php
use GuzzleHttp\Client;
use Psr\Http\Message\ResponseInterface;
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('error_log', null); // error_log to stderr
#!/usr/bin/php
<?php
use GuzzleHttp\Client;
use Psr\Http\Message\ResponseInterface;
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('error_log', null); // error_log to stderr
<?php
use GuzzleHttp\Handler\EasyHandle;
/**
* Extends Guzzle's CurlFactory package to enable better control of garbage collection after connections
* are no longer needed.
*/
class MyCurlFactory extends \GuzzleHttp\Handler\CurlFactory
{
@michaelbutler
michaelbutler / Witcher_3_Linux_Easy_README.md
Last active March 4, 2025 21:08
Install and Play The Witcher 3 Complete Edition (GOG & GOG Galaxy) on Ubuntu Linux 20.04 with Lutris.net and Wine

How to install and play The Witcher 3 (GOG Edition) on Linux

It's really quite simple!

Step 1: Buy The Witcher 3 on gog.com

Simply go to https://www.gog.com/game/the_witcher_3_wild_hunt_game_of_the_year_edition (this should also work with the regular edition) and buy and add the game to your library.

Do NOT click "Download and Install" at this point. We will do this through Lutris.

@michaelbutler
michaelbutler / Steam_Proton_Exe.md
Last active June 16, 2025 06:52
How to run another .exe in an existing proton wine prefix

Running games through Steam's Proton is great. But what if there is a secondary exe or configuration application bundled with the game? How can you launch it if Steam itself only launches the game?

Simply run this command in a terminal:

cd /path/to/steam/steamapps/compatdata/20920/pfx

STEAM_COMPAT_DATA_PATH="/path/to/steam/steamapps/compatdata/20920" WINEPREFIX=$PWD \
    "$HOME/.steam/root/steamapps/common/Proton 5.0/proton" run ./drive_c/path/to/custom_application.exe
@michaelbutler
michaelbutler / decrypt_file.sh
Last active October 26, 2024 15:13
Bash/shell script to Encrypt and Decrypt an arbitrary file using a passphrase
#!/bin/sh
set -e
# Required ENV variable: ENC_PASSPHRASE
# Usage: ENC_PASSPHRASE=my_super_long_ascii_pass_phrase123 ./decrypt_file.sh encrypted.enc secretfile.json
if [ -z "$ENC_PASSPHRASE" ]; then
echo "ERROR: Required ENC_PASSPHRASE environment variable NOT passed in."
exit 1
@michaelbutler
michaelbutler / RG351M_DPAD_README.md
Last active March 1, 2023 04:37
Guide on enhancing the D-Pad on the RG351M, likely could apply to RG351P, V, and maybe even the RG350 models.

Enhancing the D-PAD on the RG351M

So you've been playing on your RG351M, but you have noticed that the D-Pad diagonals are a bit tough to press? In some action games you have an advantage if you can quickly adjust direction from down, right-down, right in a quick and effortless fashion (Street Fighter, Zelda, side scrolling shooters, etc). You've come to the right place.

This guide will help you modify the D-Pad so that pressing the 8 directions is much easier!

⚠️ Warning!! This process is reserved for advanced users only. You must be very good with your hards working with small components to do this safely. Please proceed at your own risk. ⚠️

  • I have heard that the reset and power buttons are very delicate, it would be best to avoid putting any pressure on those buttons specifically, so that they don't snap off.
  • If you want to watch a partial video of the teardown (for RG351P) I recommend Retro Game Corps video: https://www.youtube.com/watch?v=pQYeQW8bwqQ -- it goes up to everythi