Skip to content

Instantly share code, notes, and snippets.

View rynomad's full-sized avatar

Ryan Bennett rynomad

View GitHub Profile
@rynomad
rynomad / gist:6604213
Created September 18, 2013 03:34
NDN CSTable hack
function getEntryForRegisteredPrefix(name) {
for (var i = 0; i < NDN.CSTable.length; i++) {
console.log(NDN.CSTable[i], name);
var entry = new Name(NDN.CSTable[i].name);
var interestName = new Interest(entry);
if (interestName.matches_name(new Name(name)) == true){
console.log('Match!!!', NDN.CSTable[i], name);
return NDN.CSTable[i];
}
}
var proc = {}
module.exports = proc;
var msCh = new MessageChannel()
var queue = [];
msCh.port1.onmessage = function(ev) {
var source = ev.source;
if ( ev.data === 'proc-tick') {
if (queue.length > 0) {
var fn = queue.shift();
//Object DetectSubtleCrypto()
//Establish the availability of various crypto.subtle API's necessary for keygen, signing, verification, hashing
function DetectSubtleCrypto(){
var supportedApis = {};
var baselineSupport = (
(crypto && crypto.subtle)
&& (
(location.protocol === "https:" || "chrome-extension:" || "chrome:")
|| (location.hostname === "localhost" || location.hostname === "127.0.0.1")
)
@rynomad
rynomad / gist:db7b4babd0df09c0c631
Last active August 29, 2015 14:14
crypto.subtle algorithm and feature detector
function testGenerateImportExport(cipher){
return crypto.subtle.generateKey(cipher, true, cipher.usage).then(function(keys){
if (keys.type === "secret") //only one secret key (e.g. with HMAC)
cipher.keys = [keys];
else
cipher.keys = [keys.privateKey, keys.publicKey];
var exportProms = [];
for (var i = 0; i < cipher.keys.length; i++){
exportProms.push(crypto.subtle.exportKey("jwk", cipher.keys[i]));
@rynomad
rynomad / set.txt
Created February 28, 2017 01:19
FEB 27
Setlist for 27th
Intro/Outro padding gimmies:
- franklins tower
- you don’t know how it feels
- I know you rider
- catfish john
- can’t you see
- can’t always get what you want
@rynomad
rynomad / chatGPT de-spinner
Last active April 28, 2023 20:55
highlight and drag this code into your bookmark bar. If that doesn't work, ask chatGPT how to make a bookmarklet
javascript:(function() {
function extractText(element) {
if (element.nodeType === Node.TEXT_NODE) {
return element.textContent.trim() + ' ';
}
if (element.nodeType !== Node.ELEMENT_NODE) {
return '';
}
let text = '';
for (const child of element.childNodes) {
@rynomad
rynomad / my-file.js
Created April 8, 2023 20:43
My Gist
function publishGist(button) {
if (localStorage.getItem("gistTokenName")) {
// get the gist token and publish the gist
const tokenName = localStorage.getItem("gistTokenName");
const tokenValue = localStorage.getItem("gistTokenValue");
const codeElement = button.nextElementSibling;
const gistPayload = {
description: "My Gist",
public: true,
@rynomad
rynomad / my-file.js
Created April 8, 2023 20:49
My Gist
function publishGist(button) {
if (localStorage.getItem("gistTokenName")) {
// get the gist token and publish the gist
const tokenName = localStorage.getItem("gistTokenName");
const tokenValue = localStorage.getItem("gistTokenValue");
const codeElement = button.nextElementSibling;
const gistPayload = {
description: "My Gist",
public: true,
@rynomad
rynomad / test.user.js
Created April 8, 2023 20:49
just a test
function publishGist(button) {
if (localStorage.getItem("gistTokenName")) {
// get the gist token and publish the gist
const tokenName = localStorage.getItem("gistTokenName");
const tokenValue = localStorage.getItem("gistTokenValue");
const codeElement = button.nextElementSibling;
const gistPayload = {
description: "My Gist",
public: true,
@rynomad
rynomad / test.user.js
Last active April 8, 2023 20:55
test vm via gpt
// ==UserScript==
// @name New script - github.com
// @namespace Violentmonkey Scripts
// @match https://github.com/*
// @grant none
// @version 1.0
// ==/UserScript==
function publishGist(button) {
if (localStorage.getItem("gistTokenName")) {
// get the gist token and publish the gist