Skip to content

Instantly share code, notes, and snippets.

View dcdunkan's full-sized avatar

Dunkan dcdunkan

View GitHub Profile
@dcdunkan
dcdunkan / etlab-focus.userscript.js
Last active February 27, 2025 13:30
"Focus for Etlab" UserScript for TKMCE Etlab, which declutters the dashboard and gives focus to most frequently used items.
// ==UserScript==
// @name Focus for Etlab
// @namespace Utilities for Etlab
// @match https://tkmce.etlab.in/user/dashboard*
// @include https://tkmce.etlab.in/
// @grant GM_getValue
// @grant GM_setValue
// @version 0.3
// @run-at document-end
// @author Dunkan <https://github.com/dcdunkan>
@dcdunkan
dcdunkan / 1337x-proxy-open-link.userscript.js
Last active August 20, 2024 19:26
userscript to open the magnet link right in the 1337x-to-search.pages.dev proxy
@dcdunkan
dcdunkan / etlab-auto-login.userscript.js
Last active May 6, 2024 14:22
Script for logging in automatically each time I open the damn site cuz the session is expired very quickly.
// ==UserScript==
// @name etlab auto login
// @namespace Violentmonkey Scripts
// @match https://*.etlab.in/*
// @grant GM_getValue
// @grant GM_setValue
// @version 0.4
// @author Dunkan <https://github.com/dcdunkan>
// @description 3/12/2024, 2:32:52 AM
// @run-at document-end
@dcdunkan
dcdunkan / github-raw-jio-fix.user.js
Created June 22, 2023 14:23
For some reason its not possible to access GitHub raw links via Jio's connection. So a tiny temporary unreliable fix.
// ==UserScript==
// @name GitHub raw links bypasser for Jio connections
// @namespace http://tampermonkey.net/
// @version 0.1
// @description For some reason its not possible to access GitHub raw links via Jio's connection. So a tiny temp unreliable fix.
// @author Dunkan <https://github.com/dcdunkan>
// @match http*://github.com/*
// @match http*://raw.githubusercontent.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
// @grant none
@dcdunkan
dcdunkan / broken.ts
Last active June 3, 2023 14:50
script for validating links in grammyjs/website before building the website
import { extname, join } from "https://deno.land/[email protected]/path/mod.ts";
import {
DOMParser,
HTMLDocument,
} from "https://deno.land/x/[email protected]/deno-dom-wasm.ts";
import MarkdownIt from "https://esm.sh/[email protected]";
import anchorPlugin from "https://esm.sh/[email protected]";
import { slugify } from "https://esm.sh/@mdit-vue/[email protected]";
import {
blue as b,
export interface GistOptions {
token: string;
gistId: string;
fileName: string;
}
const API_ROOT = "https://api.github.com";
export class GistKV {
constructor(private options: GistOptions) {}
@dcdunkan
dcdunkan / resolve_path.ts
Last active March 28, 2023 10:46
Resolve remote and local paths in Deno
import { fromFileUrl, isAbsolute } from "https://deno.land/[email protected]/path/mod.ts";
const isRemoteImport = ["http:", "https:"]
.includes(new URL(import.meta.url).protocol);
function isUrl(path: string) {
try {
new URL(path);
return true;
} catch (_) {
@dcdunkan
dcdunkan / slot-machine.ts
Last active February 8, 2024 07:15
Resolve Telegram's slot machine dice value (from tdesktop source)
const e = ["🔤", "🫐", "🍋", "7️⃣"];
function computePartValue(value: number, partIndex: number) {
return ((value - 1) >> (partIndex * 2)) & 0x03; // 0..3
}
function resolve(value: number) {
if (value <= 0 && value > 64) return;
let text = `${value}:`;
for (let i = 0; i < 3; i++) text += ` e[computePartValue(value, i)]`;
@dcdunkan
dcdunkan / deno_deta_base.ts
Last active March 27, 2023 10:06
Tiny https://deta.sh base client.
export class Base {
private rootUrl: string;
constructor(private projectKey: string, baseName: string) {
const projectId = projectKey.split("_")[0];
this.rootUrl = `https://database.deta.sh/v1/${projectId}/${baseName}`;
}
async request(query: string, payload?: unknown) {
const [method, ...pathname] = query.split(" ");
const response = await fetch(`${this.rootUrl}${pathname.join(" ")}`, {
@dcdunkan
dcdunkan / slideshare_bot.ts
Last active March 27, 2023 10:07
Slideshare downloader
import { Bot, InputFile } from "https://deno.land/x/[email protected]/mod.ts";
import { DOMParser } from "https://deno.land/x/[email protected]/deno-dom-wasm.ts";
import { StatusMessage } from "https://gist.githubusercontent.com/dcdunkan/235859eac749d36f4df7c00b99fbbc8f/raw/status.ts";
const bot = new Bot(Deno.env.get("BOT_TOKEN")!);
bot.command("start", async (ctx) => await ctx.reply("yeah!"));
bot.on("message:text").on("::url", async (ctx) => {
const url = ctx.message.text;