Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
set -eo pipefail
function do_megatools() {
ACTION="$1"
shift
if command -v megatools &> /dev/null; then
megatools "$ACTION" "$@"
@p-sam
p-sam / switch.sh
Created August 26, 2019 22:25
FFMPEG Compile script for Stepmania (= the PPSSPP one with a few commonly used codecs)
#!/bin/bash
set -e
GENERAL="\
--enable-cross-compile \
--arch=aarch64 \
--cross-prefix=aarch64-none-elf- \
--target-os=horizon"
@p-sam
p-sam / main.c
Created January 18, 2019 21:38
web_wifi example
// Include the most common headers from the C standard library
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
// Include the main libnx system header, for Switch development
#include <switch.h>
// See also libnx web_wifi.h.
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <switch.h>
#include "web_wifi.h"
#define PRINT_RC(str, rc) printf("[!] %s: [0x%x] %04d-%04d\n", str, rc, R_MODULE(rc), R_DESCRIPTION(rc))
void userAppInit() {
@p-sam
p-sam / exit.c
Last active October 9, 2018 14:31
#include <string.h>
#include <stdio.h>
#include <switch.h>
int main(int argc, char **argv)
{
gfxInitDefault();
consoleInit(NULL);
socketInitializeDefault();
@p-sam
p-sam / unpack_osm_songs.sh
Created September 18, 2018 09:50
unpack Old School Musical soundtrack from the game
#!/bin/bash
SONG_DIR="$(pwd)/StreamingAssets"
OUT_DIR="$(pwd)/SongExtracted"
#pip3 install lz4 unitypack fsb5 vorbis
#apt-get install libvorbis
mkdir -p "$OUT_DIR"
find "$SONG_DIR" -iname 'song-*' -exec unityextract --all -o "$OUT_DIR" {} \;
@p-sam
p-sam / build.gradle
Last active April 8, 2018 19:26
Gradle build versoning + signing
import java.text.SimpleDateFormat
def getHash = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}
@p-sam
p-sam / ClockworkMiddleware.php
Created June 22, 2017 10:11
Example of PSR-7 Messages DataSource usage in Slim 3
<?php
namespace Kernel\Middleware;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Clockwork\Helpers\ServerTiming;
use Clockwork\DataSource\PsrMessageDataSource;
use Clockwork\Clockwork;