Skip to content

Instantly share code, notes, and snippets.

View Explosion-Scratch's full-sized avatar

--Explosion-- Explosion-Scratch

View GitHub Profile
// ==UserScript==
// @name Bard
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://*.youtube.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=textarea.online
// @grant GM_xmlhttpRequest
// @grant unsafeWindow
// ==/UserScript==
import fs from 'fs';
import { exec, execSync } from 'child_process';
import { join } from 'path';
import path from 'path';
const args = process.argv.slice(2);
if (!process.env.SUDO_UID) {
console.log('Re-run as sudo');
process.exit(1);
@Explosion-Scratch
Explosion-Scratch / ChatGPT for google userscript.user.js
Last active September 23, 2023 16:22
ChatGPT userscript for google with web access, code copy and more
// ==UserScript==
// @name ChatGPT google
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.google.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com
// @grant GM_xmlhttpRequest
// @grant GM_getValue
@Explosion-Scratch
Explosion-Scratch / Set mac accent colors based on wallpaper.ts
Last active August 13, 2023 18:35
Set the mac accent color to the closest matching color that matches your wallpaper
#!/usr/bin/env deno
import Vibrant from "npm:node-vibrant"
import cd from "npm:color-difference"
const COLORS: { [number | string]: string } = {
4: "#336ED1",
5: "#7F2689",
6: "#B95081",
0: "#AC312D",
@Explosion-Scratch
Explosion-Scratch / Auto install node modules.js
Last active July 22, 2023 13:47
Auto install node modules from a file
#!/usr/bin/env node
// Usage:
// autoinstall file.js --manager pnpm
// autoinstall file1.js file2.js
// Build to binary: esbuild index.js --bundle --outfile=build.cjs --format=cjs --platform=node && pkg -t node16-linux,node16-win,node16-macos-x64,node16-macos-arm64 build.cjs -C GZip -o autoinstall && rm -rf build.cjs
import fs from "fs/promises";
import path from "path";
((window) => {
var _fetch = window.fetch; //Get the original fetch functionm
window.fetch = (url, opts = {}) => {
if (!window.FETCH_CACHE) {
window.FETCH_CACHE = {};
}
return new Promise((resolve) => {
/*
Generate a sort of unique key about this fetch request.
@Explosion-Scratch
Explosion-Scratch / function_log.js
Last active May 6, 2023 04:49
Function log prototype manipulation
Function.prototype.log = function () {
function annotate(func) {
return (func + "")
.replace(/[/][/].*$/gm, "")
.replace(/\s+/g, "")
.replace(/[/][*][^/*]*[*][/]/g, "")
.split("){", 1)[0]
.replace(/^[^(]*[(]/, "")
.replace(/=[^,]+/g, "")
.split(",")
function url(u) {
const GITHUB_API_URL = "https://api.github.com";
const TEMPLATES = [
[
/^(https?):\/\/gitlab\.com\/([^\/]+.*\/[^\/]+)\/(?:raw|blob)\/(.+?)(?:\?.*)?$/i,
"$1://gl.githack.com/$2/raw/$3",
],
[
/^(https?):\/\/bitbucket\.org\/([^\/]+\/[^\/]+)\/(?:raw|src)\/(.+?)(?:\?.*)?$/i,
@Explosion-Scratch
Explosion-Scratch / print.js
Created September 7, 2021 20:39
Print from GitHub markdown pages
javascript: {
var container =
document.querySelector("article") ||
document.querySelector("#readme .Box-body article") ||
document.querySelector("#readme") ||
document.querySelector(".page");
if (document.querySelector(".final-path")) {
var header = document.createElement("h1");
header.innerText = document.querySelector(".final-path").innerText;
@Explosion-Scratch
Explosion-Scratch / translate.js
Created September 11, 2021 02:30
Translate text using the google translate API
// const {translated} = await translate("bonjour");
// --> "Hello"
async function translate(text, target, source) {
var opts = {
text: text || "",
source: source || 'auto',
target: target || "en",
}
var result = await fetch(`https://translate.googleapis.com/translate_a/single?client=gtx&sl=${opts.source}&tl=${opts.target}&dt=t&q=${encodeURI(opts.text)}`).then(res => res.json());
return {