Skip to content

Instantly share code, notes, and snippets.

View neopunisher's full-sized avatar
🎯
Focusing

Carter Cole neopunisher

🎯
Focusing
View GitHub Profile
if (HTMLScriptElement.supports && HTMLScriptElement.supports('importmap')) {
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap
const importMap = {
imports: {
lazyload: 'IntersectionObserver' in window
? './lazyload.js'
: './lazyload-fallback.js',
},
};
function createCSV(data, fileName) {
const headers = [
'id',
'author_name',
'post',
'is_post',
'comment',
'is_comment',
'first_name',
'last_name',
@neopunisher
neopunisher / bypass-cloudflare-email-protection.js
Last active December 31, 2024 00:19
How to circumvent Cloudflare's [email protected] thing, WITHOUT enabling Javascript
// Adapted from https://raddle.me/f/Privacy/3722/how-to-circumvent-cloudflare-s-email-protected-thing-without with the help of chatGPT
function fixObfuscatedEmails() {
const elements = document.getElementsByClassName('__cf_email__');
for (let i = 0; i < elements.length; i++) {
const element = elements[i];
const obfuscatedEmail = element.getAttribute('data-cfemail');
if (obfuscatedEmail) {
const decodedEmail = decrypt(obfuscatedEmail);
element.setAttribute('href', 'mailto:' + decodedEmail);
element.innerHTML = decodedEmail;
@neopunisher
neopunisher / japanese-sayings.txt
Last active March 21, 2023 19:11
Sayings from all the languages I could find
初志貫徹 (shoshikantetsu) - "to carry out original intent"
一期一会 (ichigoichie) - "Treasure every encounter, for it will never recur."
一日一歩 (iichinichiippo) - "One step each day."
十人十色 (jūnintoiro) - "To each their own; So many people, so many minds"
匠の技 (Takumi no waza) - "the expertise of master craftsmen"
const buf = new ArrayBuffer(maxBufferLen);
const dv = new DataView(buf);
class MagicWindow {
constructor(name, getter, setter) {
Object.defineProperty (window, name, {
get: getter,
set: setter
});
}
[...Array(256).keys()].map((idx)=>{idx=Number(idx);return{char:String.fromCharCode(idx), hex: idx.toString(16), dec: idx, bin: (idx >>> 0).toString(2).padStart(8,'0')}})
async (clipboardContentString) => {
try {
const response = await fetch("https://api.openai.com/v1/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR API KEY HERE"
},
body: JSON.stringify({
model: "text-davinci-003",
// String stuff
const encodeStr = (str)=>new TextEncoder().encode(str)
const strLen = (str)=> encodeStr(str).length
const stoa = (str)=>Uint8Array.from(str, x => x.charCodeAt(0))
const atos = (arr)=>String.fromCharCode.apply(null, arr)
// Base 2 stuff
const getBaseLog = (x, y) => (Math.log(y) / Math.log(x))
const baseTwoLog = (y) => getBaseLog(2,y)
const powTwo = (x)=>Math.pow(2,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/[email protected]/pkg.js')
const wasmURL = 'https://cdn.jsdelivr.net/npm/@tailscale/[email protected]/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),