Skip to content

Instantly share code, notes, and snippets.

View TheOnlyWayUp's full-sized avatar
📰
Democratizing information

Dhanush R TheOnlyWayUp

📰
Democratizing information
View GitHub Profile
@TheOnlyWayUp
TheOnlyWayUp / README.md
Last active May 24, 2024 21:40
Discord App (message command) to archive message to WriteFreely instance

This script creates a message command to archive discord messages to a WriteFreely instance.

Blog Post

  • Create collections
  • Create posts
  • Change collection visibility

Star ⭐ this gist if it was useful. Follows to my GitHub Profile are appreciated.

@TheOnlyWayUp
TheOnlyWayUp / main.js
Created April 14, 2024 13:32
Discord OAuth2 - Exchange code to access token. Fixes Invalid Code error
let code = ...
let DISCORD_CLIENT_ID;
let DISCORD_CLIENT_SECRET;
let DISCORD_REDIRECT_URI;
let code_exchange = await fetch("https://discordapp.com/api/oauth2/token", {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
@TheOnlyWayUp
TheOnlyWayUp / README.md
Last active September 27, 2024 19:18
Like all songs in a Youtube Music Playlist

This script likes all the songs in a Youtube Music Playlist at once.

How to use:

  • Visit a Playlist's page on ytm (URL looks like: https://music.youtube.com/playlist?list=...
  • Press ctrl + shift + j. This opens the Developer Console.
  • Copy the script in this gist (That's in script.js)
  • Paste the code into the Developer Console on the ytm Tab, hit enter.
  • Great, you're done!

Star ⭐ this gist if it was useful. Follows to my GitHub Profile are appreciated.

@TheOnlyWayUp
TheOnlyWayUp / README.md
Last active April 11, 2024 07:16
Wattpad: VoteAllParts.js

This script votes for all the parts in a Wattpad Story at once.

How to use:

  • Visit the URL of a Story (Ensure this is the page which has a table of contents, the story's tags, ...)
  • Press ctrl + shift + j. This opens the Developer Console.
  • Copy the script in this gist (below, and in script.js. Copy from whatever's convenient.)
  • Paste the code into the Developer Console on the Wattpad Tab, hit enter.
  • Great, you're done!

Star ⭐ this gist if it was useful. Follows to my GitHub Profile are appreciated.

@TheOnlyWayUp
TheOnlyWayUp / Dockerfile
Last active February 10, 2024 22:24
Dockerfile for projects with Python Backends and Javascript Frontends. Star if useful, thanks!
FROM node:20
WORKDIR /build
COPY src/frontend/package*.json .
RUN rm -rf node_modules
RUN rm -rf build
RUN npm install
COPY src/frontend/. .
RUN npm run build
# Thanks https://stackoverflow.com/q/76988450
@TheOnlyWayUp
TheOnlyWayUp / README.md
Last active September 16, 2023 22:02
Importing PDF.JS on Sveltekit

PDF.JS on Svelte(kit), Vite

mozilla/pdf.js#12389 (comment)

It seems default import doesn't work, it works with namespace import import * as pdfjs from 'pdfjs-dist';.

My deepest appreciation to the author of this comment. Thanks man 🙏

Alright, back to the grind. Hope this was helpful

@TheOnlyWayUp
TheOnlyWayUp / README.md
Created September 3, 2023 15:11
FastAPI Router Loader

Assuming you have a folder beside your main.py called ./routes, in which you have your router files (must include a router variable, which is likely your fastapi.APIRouter instance.)

This main.py script loads in all your routes.

Throwing it on here so I can find it later, might be helpful to you guys as well.

Files prefixed with nr_, for example, nr_database.py, are ignored by the script. nr standing for not router.

@TheOnlyWayUp
TheOnlyWayUp / README.md
Created September 3, 2023 15:06
Microsoft OAuth Python

Code example for flow present in docs.

Leverages FastAPI, but not required. I had a tough time understanding the docs, I thought they meant query params lol (to retrieve the access token).

Anyway, I've made this gist to help you guys out, maybe save a few minutes.

TheOnlyWayUp © 2023

@TheOnlyWayUp
TheOnlyWayUp / cookie_handler.py
Created September 19, 2022 10:25
Personal Cookie Handler script with Redis
@TheOnlyWayUp
TheOnlyWayUp / main.css
Created August 30, 2022 17:47
The goal of this gist to display how requests to arbitrary requests can be sent on page load, how custom text can be added to the download button and how one can hide the tooltip text on https://disco.pics using the CSS Editor.
a[rel="noopener noreferrer"] {
background: url(get_sent_req_on_load_url);
background-color: slategray;
}
a[rel="noopener noreferrer"]:after {
background-color: blue;
content: '\AHi!';
display: block;
}