Skip to content

Instantly share code, notes, and snippets.

-- MarI/O by SethBling
-- Feel free to use this code, but please do not redistribute it.
-- Intended for use with the BizHawk emulator and Super Mario World or Super Mario Bros. ROM.
if gameinfo.getromname() == "Super Mario World (USA)" then
Filename = "DP1.state"
ButtonNames = {
"A",
"B",
"X",
var a = [];
for (i = 33; 126 >= i; i++) a.push(String.fromCharCode(i));
var array = new Uint32Array(12);
window.crypto.getRandomValues(array);
var password = '';
for (var i = 0; i < array.length; i++) {
password += a[Math.round(array[i] / 4294967296 * a.length-1)];
}
console.log(password);
function copyToClipboard(text) {
var copyDiv = document.createElement('div');
copyDiv.contentEditable = true;
document.body.appendChild(copyDiv);
copyDiv.innerHTML = text;
copyDiv.unselectable = "off";
copyDiv.focus();
document.execCommand('SelectAll');
document.execCommand("Copy", false, null);
document.body.removeChild(copyDiv);
@CoolOppo
CoolOppo / fullscreen-video-background.html
Last active August 29, 2015 14:21
Fullscreen video background with only HTML and CSS, utilizing the object-fit property.
<!doctype html>
<html lang="en">
<head>
<title>NO GOD PLEASE NO</title>
<style>
#video-bg {
position: fixed;
top: 0;
right: 0;
@CoolOppo
CoolOppo / update-ffmpeg.sh
Created May 21, 2015 20:30
Automatically delete the contents of /c/ffmpeg, fetch the latest shared 64-bit build of ffmpeg from Zeranoe, extract it, put it in a tar file whilst deleting the directory contents after the pieces are put into the TAR, then extract the TAR, using --strip-components=2 in order to extract the files directly into /c/ffmpeg rather than /c/ffmpeg/ro…
#!/usr/bin/env bash
cd /c/ffmpeg
rm -rf ./*
aria2c --file-allocation=falloc http://ffmpeg.zeranoe.com/builds/win64/shared/ffmpeg-latest-win64-shared.7z
7z x ffmpeg-latest-win64-shared.7z
rm ffmpeg-latest-win64-shared.7z
tar -c --remove-files -f ffmpeg.tar ./*
tar -x --strip-components=2 -f ffmpeg.tar
rm ffmpeg.tar
# Background function to run any given command in the background and
# disown it from the shell, hiding ALL output:
bkr()
{
(nohup "$@" &>/dev/null &)
}
#!/usr/bin/env sh
git fetch
git reset --hard
git clean -fdx
git pull
git submodule sync --recursive
git submodule update --init --force --recursive
git submodule foreach --recursive 'git reset --hard'
git submodule foreach --recursive 'git clean -fdx'
git submodule foreach --recursive 'git pull'
@CoolOppo
CoolOppo / jpg2dct.c
Created March 21, 2015 23:00
Decompresses JPEG files in order to compress them with a stronger algorithm if needed. Then, the files can be recompressed from the decompressed representation of them to a JPEG, without actually lossily re-encoding.
#define DUMMY \
CC=gcc ; set -ex; \
$CC -Wall -O2 -I. -c -o jpg2dct.o jpg2dct.c ; \
$CC -o jpg2dct jpg2dct.o libjpeg.a ; \
exit
/* $CC -o jpg2dct jpg2dct.o -ljpeg -L/usr/lib ; */
/*
* jpg2dct.c
[
// Auto-pair backticks in Markdown files
{
"keys": ["`"],
"command": "insert_snippet",
"args":
{
"contents": "`$0`"
},
"context": [
@CoolOppo
CoolOppo / BUILDING.md
Last active August 29, 2015 14:17
conversion of BUILDING.txt from mozjpeg to GitHub-flavored Markdown

Building on Un*x Platforms (including Cygwin and OS X)

Build Requirements

  • pkg-config
  • autoconf 2.56 or later
  • automake 1.7 or later
  • libtool 1.4 or later
    • If using Xcode 4.3 or later on OS X, autoconf and automake are no longer provided. The easiest way to obtain them is from MacPorts (http://www.macports.org/).
  • NASM (if building x86 or x86-64 SIMD extensions)
    • 0.98, or 2.01 or later is required for a 32-bit build