Skip to content

Instantly share code, notes, and snippets.

View neopunisher's full-sized avatar
🎯
Focusing

Carter Cole neopunisher

🎯
Focusing
View GitHub Profile
@neopunisher
neopunisher / combinators.js
Created June 7, 2018 19:04 — forked from Avaq/combinators.js
Common combinators in JavaScript
const I = x => x;
const K = x => y => x;
const A = f => x => f(x);
const T = x => f => f(x);
const W = f => x => f(x)(x);
const C = f => y => x => f(x)(y);
const B = f => g => x => f(g(x));
const S = f => g => x => f(x)(g(x));
const P = f => g => x => y => f(g(x))(g(y));
const Y = f => (g => g(g))(g => f(x => g(g)(x)));
// extracts data from https://imgflip.com/popular-meme-ids
console.log("./imgflip-single.sh " + Array.from(document.querySelectorAll('table.admin-table tr td:nth-child(2n)')).map((a)=>a.innerText.replace(/[\W]+/g," ").split(' ').join('-')).join("\n./imgflip-single.sh "))
@neopunisher
neopunisher / browser-webserver.js
Last active December 17, 2022 16:31
An attempt at serving a simple website using tailscale's beta funnel feature from a browser tab
// Im doing this "standalone" from the js console in an about:blank page
const tsconn = await import('https://cdn.jsdelivr.net/npm/@tailscale/connect@1.33.0-t2be951a58/pkg.js')
const wasmURL = 'https://cdn.jsdelivr.net/npm/@tailscale/connect@1.33.0-t2be951a58/main.wasm'
const ipn = await tsconn.createIPN({wasmURL})
ipn.run({
notifyState: (state)=>console.log('notifyState:', state),
notifyNetMap: (netMap)=>console.log('notifyNetMap:', netMap),
notifyBrowseToURL: (url)=>console.log('notifyBrowseToURL:', url),
notifyPanicRecover: (err)=>console.log('notifyPanicRecover:', url),
document.addEventListener('yourCustomEvent', function (e) {
var data = e.detail;
console.log('received', data);
});
var data = {
allowedTypes: 'those supported by structured cloning, see the list below',
inShort: 'no DOM elements or classes/functions',
};
@neopunisher
neopunisher / plugin
Last active September 3, 2022 15:04
A sample shell script for munin-node that can autoconf
#!/bin/sh
LOG=${logfile:-/var/log/munin/plugin.log}
#%# family=auto
#%# capabilities=autoconf suggest
case $1 in
config)
cat <<'EOM'
var EventSource = require("eventsource");
var es = new EventSource(
"https://horizon-testnet.stellar.org/accounts/GB7JFK56QXQ4DVJRNPDBXABNG3IVKIXWWJJRJICHRU22Z5R5PI65GAK3/payments",
);
es.onmessage = function (message) {
var result = message.data ? JSON.parse(message.data) : message;
console.log("New payment:");
console.log(result);
};
es.onerror = function (error) {
@neopunisher
neopunisher / ans_stellar_quest_nft.js
Last active May 22, 2021 01:41
Stellar quest nft solution
var data = require('./data.json'); #transaction with operations downloaded saved as json
var ops = data._embedded.records.map((r)=>[r.name, new Buffer.from(r.value, 'base64')])
var StellarSdk = require("stellar-sdk");
var server = new StellarSdk.Server("https://horizon-testnet.stellar.org");
var key = StellarSdk.Keypair.fromSecret(
#secret key here
);
@neopunisher
neopunisher / inject-react.js
Last active January 22, 2021 06:42
Pull react into the page
(function(inj){
inj('https://unpkg.com/react@16/umd/react.development.js').then(()=>inj('https://unpkg.com/react-dom@16/umd/react-dom.development.js')).then(()=>inj('https://unpkg.com/babel-standalone@6.15.0/babel.min.js')).then(function(){
var out=document.createElement("div");out.id='testing';
document.body.appendChild(out)
console.log('loaded babel')
Babel.registerPlugin('eval_wrapper', function eval_wrapper() { return {visitor: {
FunctionDeclaration(path) {
console.log('a func')
// debugger
},
@neopunisher
neopunisher / md5collext.sh
Created July 15, 2013 13:43
Test md5 hash collision and message extension
wget http://marc-stevens.nl/research/md5-1block-collision/message1.bin
wget http://marc-stevens.nl/research/md5-1block-collision/message2.bin
md5sum *.bin
#008ee33a9d58b51cfeb425b0959121c9 message1.bin
#008ee33a9d58b51cfeb425b0959121c9 message2.bin
echo "some extra" > extra.txt
cat message1.bin extra.txt | md5sum
#c4dda4dbd429421349c0ca6172cc2e95
cat message2.bin extra.txt | md5sum
#c4dda4dbd429421349c0ca6172cc2e95
@neopunisher
neopunisher / sendemail.asp
Created September 27, 2011 18:57
Classic ASP send email
sub sendemail(subject,body,sto)
Set objMessage = CreateObject("CDO.Message")
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.gmail.com"
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "no-reply@brandextract.com"
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "passwd" ' change thus
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
objMessage.Configuration.Fields.Update