Skip to content

Instantly share code, notes, and snippets.

@PhoenixIllusion
PhoenixIllusion / build.gradle
Created December 3, 2015 18:32
Using the local.properties file of an Android Studio project to select the latest BuildTools version
apply plugin: 'com.android.library'
android {
compileSdkVersion 'Google Inc.:Google APIs:22'
Properties localProps = new Properties()
localProps.load(new FileInputStream(file('../local.properties')))
def buildToolVer = file("${localProps['sdk.dir']}/build-tools/").listFiles().sort().reverse().first().name;
buildToolsVersion buildToolVer;
@PhoenixIllusion
PhoenixIllusion / OctoPI - 3d GCODE.js
Created May 2, 2017 21:10
Store in Chrome Snippets and Run while on the 2D GCode Viewer to turn it into a 3D GCode Viewer
var addScript = function (url) {
var doc = document;
var tag = 'script';
return new Promise((resolve,reject) => {
if(!doc.querySelector(tag+"[src='"+url+"']")){
var ele = doc.createElement(tag);
var firstEle = doc.getElementsByTagName(tag)[0];
ele.async = 0;
ele.src = url;
firstEle.parentNode.insertBefore(ele, firstEle);
@PhoenixIllusion
PhoenixIllusion / media-recorder-snippet.js
Created May 1, 2018 21:49
Media-Recorder : Record Canvas/Video
(function() {
window.blobURL = null;
function blobToFile(blob, filename) {
if(window.blobURL != null) {
URL.revokeObjectURL(window.blobURL)
}
window.blobURL = URL.createObjectURL(blob);
if(window.link == null) {
window.link = document.createElement("a");
@PhoenixIllusion
PhoenixIllusion / android-keystore-password-checker.html
Last active January 10, 2019 17:30
This is a stand-alone HTML page with Javascript and no external script files for parsing a KeyStore, displaying the information about the internal public cert, and allowing checking of passwords agains the Store Password (file-hash check), and validating the Private Key password for the 1st alias using the JKS SHA1-chain technique.
<html>
<head>
<style>
#key_password, #password {
width: 300px;
margin-right: 5px;
}
#key_valid, #valid {
height: 30px;
line-height: 30px;
function dist(){
RET=`echo "$1 $2 $3 $4" | \
awk '
function ceil(valor)
{
return (valor == int(valor)) ? valor : int(valor)+1
}
function a(dx,dy) {
return sqrt(dx*dx+dy*dy);
}
@PhoenixIllusion
PhoenixIllusion / mask_gif_onto_image.sh
Created April 1, 2019 14:26
Takes a source gif, an overlay image, and a transformed texture square to render under the overlay image. Position animated GIF inside image
FILTER="
[0:v] scale=512:512[src];
[2:v]format=rgba64,colorchannelmixer=rr=1/128:bb=1/128[map16];
[map16]extractplanes=r+b+a[x][y][a];
[src][x][y]remap[remap];
[remap][a]alphamerge[remapa];
[remapa][1:v]overlay"
echo "===="
echo $FILTER
echo "===="
@PhoenixIllusion
PhoenixIllusion / native-zip-file-browse.js
Created March 10, 2020 21:30
Read Zip File - Built-In DecompressionStream for entries
"use strict"
const ZIP_EOCD = 0x06054b50;
const ZIP_CENTRAL_DIR_HEADER = 0x02014b50;
const ZIP_LOCAL_HEADER = 0x04034b50;
const decoder = new TextDecoder();
const GZIP_HEADER = new Uint8Array([31,139, 8, 0, 0,0,0,0, 0, 255]);
function deflateFooter(crc, isize){
const footer = new DataView(new Uint8Array(8).buffer);
@PhoenixIllusion
PhoenixIllusion / native-zip-file-browse.regpack.js
Created March 10, 2020 23:38
Minified RegPack native-DecompressionStream (with pako rawDeflate fallback) Zip parser for reading ZipFile and getting Blobs of decompressed content
/*
const zip = new ZipReader(fileBlob);
await zip.parse();
console.log(zip.RECORDS);
const blob = await zip.getRecord(1);
*/
for(_=`;s++*pako@(t,eM,!0)Qco^^nst ~~e=%.p($en#e.Ye(XetW])Ki.c||i.fJ],Iif(H,2G.sFin);new ResponsX,{s:or(){this.&&(i+=awaitufferlobRECORDS)).push(async {^nstructtdocum#t.,0,0, De^mpressionStream DataView( functionUt8Array(YbyteL#gthWUt32(rWurn  a(b,GGGG,4,4,$[4K[0Kthrow Err"Error parsg #try"(()=>{"use strict"; tM,nHwdow. ~i= ("gzip"),r= 8).brF0,eQ,rF4,nQ,B([s,t,rKFtream().pipeThrough(i.b()}{(i="https://cdnjs.cloudflarY^m/ajax/libs/@/1.0.10/@_flatYm.js",PromisXMHquerySelect"script[src='"+i+"']"t(ielse{%createElem#t("script"eFrc=i,Yonload=(t(i)},gWElem#tsByTagNamX"head")[0].app#dChild(e)}};%@.flateRaw(tB([eK}var i}%TextDe^der;class nd=t,i=0}p(t~n=[];flW s=0;s<t.l#gth*~i=t[s];HiFn[iFK,J~t=n[J];i+=t;~s=d.b,i-t,tni.f?Yde^dXs):s)}2==i2,nd.gWUt16(i-2,!0),4==i4,nd.gi-4,!0)}n}}~s
@PhoenixIllusion
PhoenixIllusion / BingoCardMaker.html
Created May 29, 2020 19:28
Allows editing and saving Bingo Cards
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.js"></script>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" viewport="0 0 410 510" width="410" height="510" style="width: 100vw;max-width:600px;">
<style>
text {
font-family: sans-serif;
@PhoenixIllusion
PhoenixIllusion / Stereogram-TWGL.html
Last active January 5, 2024 20:35
Stereogram Shader with configurable Pattern, Depth, and values
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GLSL Stereogram</title>
<style>
canvas {
image-rendering: crisp-edges;