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
@defulmere
defulmere / settings.py
Last active September 10, 2025 20:13
How to override an old sqlite3 module with pysqlite3 in django settings.py
# ⚠️ USE AT YOUR OWN RISK
# first: pip install pysqlite3-binary
# then in settings.py:
# these three lines swap the stdlib sqlite3 lib with the pysqlite3 package
__import__('pysqlite3')
import sys
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
DATABASES = {
@Snarp
Snarp / google-docs-copy.js
Last active December 26, 2025 00:42
Script to allow copying from a protected Google Doc
/*
<https://stackoverflow.com/questions/40296831/is-it-possible-to-force-a-copy-of-a-protected-google-doc>
NOTE - 2021-05-24
-----------------
The script below isn't the fastest way to copy-and-paste from a protected
Google Doc. Before trying it, I'd suggest following MikoFrosty's advice from
the comments:
@calexandre
calexandre / merge-zsh-history.sh
Last active September 28, 2025 12:23
Merge two zsh history files
#!/bin/bash
# Inspired on https://david-kerwick.github.io/2017-01-04-combining-zsh-history-files/
set -e
history1=$1
history2=$2
merged=$3
echo "Merging history files: $history1 + $history2"
test ! -f $history1 && echo "File $history1 not found" && exit 1
@berndverst
berndverst / Readme.md
Last active November 12, 2025 18:39
Script to quickly merge captions into mp4 H.264 (or HEVC/H.265) video as selectable or burned in subtitles from command-line

Add captions to MP4 videos as subtitles

Requirements

FFMpeg must be installed.

Instructions:

@diegodlh
diegodlh / pdf_js_textLayer_selection
Last active September 21, 2023 20:11
How to see text selected in pdf files with pdf.js?
Sometimes, text that can be selected in pdf files (text overlay) does't match exactly the text as it is shown in the canvas layer. As a result, if one wants to select some text (for copy-pasting, for example) it is difficult to say if one has selected the right characters.
Here I show one way to see the text selected using pdf.js, the pdf reader that is used, for example, in Firefox.
1) Find the path to your profile directory: In Firefox, press Tab to see the menu bar, go to Help > Troubleshooting information. Click "Open Directory" next to "Profile directory".
2) Create a folder named "chrome" in your profile folder and a userContent.css file inside.
3) Write this in the userContent.css file that you created, and save it:
@-moz-document regexp('.*\.(p|P)(d|D)(f|F)') {
.textLayer ::selection {
color: white;
@agentspawn
agentspawn / aiorejson.py
Created May 25, 2020 01:46
RedisJSON for aioredis
class ReJSON:
def __init__(self, _redis):
self.redis = _redis
async def set(self, key, path, jsonable, nx=False, xx=False):
"""
Set the JSON value at ``key`` under the ``path`` to ``jsonable``
``nx`` if set to True, set ``value`` only if it does not exist
``xx`` if set to True, set ``value`` only if it exists
"""
@turicas
turicas / screenshot.py
Created June 6, 2020 20:34
Python script to take screenshot of a website
#!/usr/bin/env python3
# requires: pip install splinter
import argparse
import datetime
import os
import shutil
import time
from urllib.parse import urlparse
from pathlib import Path
@haideralipunjabi
haideralipunjabi / main.py
Created June 15, 2020 02:30
Python Script to scrape an OpenDirectory
import requests
from bs4 import BeautifulSoup as soup
import os
from progress.bar import Bar
import wget
from urllib.parse import unquote
base = "http://www.meeshdesigns.com/Western%20Fonts/"
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
@haykkh
haykkh / fastapi-discord.py
Created June 24, 2020 10:09
How to run a discord.py bot with FastAPI
import asyncio
import discord
from fastapi import FastAPI
app = FastAPI()
client = discord.Client()
# where the magic happens
# register an asyncio.create_task(client.start()) on app's startup event
@Soheab
Soheab / API's.md
Last active November 23, 2025 13:27
See here some of the API's you can use in your discord bot or anything

Some APIs for you.

Here are some APIs you can use in your Discord bot or any other project. For any help or questions on how to use one, please contact the owner of the API and not me.

A bigger list of APIs can be found at: https://github.com/public-apis/public-apis


[TOKEN] = API requires a token to access some if not all endpoints.