https://gist.github.com/ryancdotorg/7f1aca1ae49628442a87b9e9d9e01e3e
View default.conf
# An opinionated nginx default server configuration block | |
# Author: Ryan Castellucci https://rya.nc/ @ryancdotorg | |
# Revision: 2021-02-07 | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
server_name _; | |
# Send ACME (LetsEncrypt) requests to a special directory |
View setImmediate.js
(function(global, name, mc, counter, slice){ | |
if (!(name in global)) { | |
if (mc = mc in global && new global[mc]) { | |
mc.port1.onmessage = function(evt) { | |
slice[evt = evt.data](); | |
delete slice[evt]; | |
}; | |
global[name] = function(cb) { | |
var args = slice.call(arguments, 1); |
View Makefile
all: javascript | |
javascript: bundle_js min_js | |
bundle_js: $(patsubst %/,%.bundle.js,$(foreach js,$(sort $(dir $(wildcard src/js/*/*.js))),$(subst src/,static/,$(js)))) | |
min_js: $(patsubst %.js,%.min.js,$(foreach js,$(wildcard src/js/*.js),$(subst src/,static/,$(js)))) | |
static/js/%.min.js: src/js/%.js | |
terser $< --safari10 --ecma 5 -c passes=2 -m --mangle-props regex=/^_/ -o $@ |
View fnode.js
#!/usr/bin/env node | |
// save somewhere in $PATH as fnode, remember to chmod +x | |
const vm = require('vm'); | |
const fs = require('fs'); | |
const tty = require('tty'); | |
const path = require('path'); | |
const repl = require('repl'); |
View sw.js
var ArchiveReader = function(ab) { | |
if (!(this instanceof ArchiveReader)) { | |
throw new Error('ArchiveReader must be instantiated with `new`!'); | |
} | |
this.ab = ab; | |
this.dv = new DataView(ab); | |
this.offset = 0; | |
this.td = typeof TextDecoder === 'function' ? new TextDecoder() : null; | |
} |
View nd-json-tar.py
#!/usr/bin/env python3 | |
import os, sys | |
import json | |
import tarfile | |
# apply attributes | |
def modify(attrib, stat, info): | |
if 'mtime' in attrib: | |
info.mtime = attrib['mtime'] |
View tasker-randomize-ad-id.xml
<TaskerData sr="" dvi="1" tv="5.9.2"> | |
<Profile sr="prof22" ve="2"> | |
<cdate>1568555561584</cdate> | |
<edate>1569679198184</edate> | |
<id>22</id> | |
<mid0>21</mid0> | |
<nme>Rotate Ad ID</nme> | |
<Time sr="con0"> | |
<fh>0</fh> | |
<fm>0</fm> |
View web-crypto-scrypt.js
// Based on https://github.com/ricmoo/scrypt-js | |
"use strict"; | |
(function(root) { | |
const MAX_VALUE = 0x7fffffff; | |
// Returns a Promise that resolves to an ArrayBuffer. | |
async function PBKDF2_HMAC_SHA256(password, salt, iterations, dkLen) { | |
return crypto.subtle.importKey('raw', password, {name: 'PBKDF2'}, false, ["deriveBits"]).then( |
View setgw.sh
#!/bin/sh | |
IFACE="$1" | |
SRCIP="$2" | |
DSTIP="$3" | |
MAC=`/usr/sbin/arping -r -C1 -w10 -i "$IFACE" -S "$SRCIP" "$DSTIP"` | |
if [ $? -eq 0 ] | |
then | |
/sbin/ip neigh replace "$DSTIP" lladdr "$MAC" dev "$IFACE" nud permanent || exit $? | |
/sbin/ip route replace default via "$DSTIP" dev "$IFACE" || exit $? | |
else |
NewerOlder