Skip to content

Instantly share code, notes, and snippets.

@kms70847
kms70847 / remove_signup_bar.user.js
Created Oct 29, 2021
Remove Signup Bar From Twitter
View remove_signup_bar.user.js
// ==UserScript==
// @name Remove Signup Bar
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Remove the "sign up for twitter!" bar that blocks 20% of the content on every Twitter page
// @author Kevin
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?domain=twitter.com
// @grant none
// ==/UserScript==
@kms70847
kms70847 / original.py
Last active May 8, 2021
A reverse-engineering of Aran-Fey's obfuscated script
View original.py
#copied from https://chat.stackoverflow.com/transcript/message/52153354#52153354
class folly(zip(), zip(__name__), zip(), zip(__file__), zip()):
hel = help
locals()[r""u'''d
'''fr''] = __qualname__
exc = exit
def Tel(f, a, k):
return getattr(a[0], f)(*a[1:], **dict(tuple(k.items())[2:]))
@kms70847
kms70847 / main.py
Last active Oct 22, 2019
Gold Badge Counter
View main.py
import requests
import base64
import os
import pickle
import time
import re
import json
from bs4 import BeautifulSoup as BS
MIN_TIME_BETWEEN_REQUESTS = 10
View UnicodeEmojiAdder.user.js
// ==UserScript==
// @name UnicodeEmojiAdder
// @version 6
// @include http://chat.stackoverflow.com/rooms/*
// @include https://chat.stackoverflow.com/rooms/*
// @grant none
// ==/UserScript==
var style_template = `
.boxPositioner{
@kms70847
kms70847 / EmoticonAdder.user.js
Last active Sep 25, 2019
Emoticon Adder Userscript
View EmoticonAdder.user.js
// ==UserScript==
// @name Emoticon Adder
// @version 1
// @include http://chat.stackoverflow.com/rooms/*
// @include https://chat.stackoverflow.com/rooms/*
// @grant none
// ==/UserScript==
//note: emoticons with slash characters, for example ¯\_(ツ)_/¯, must be quadruple-escaped. Once for javascript, and again for markdown.
var choices = ["---", "(◕‿◕)", "(╯°□°)╯︵ ┻━┻", "( ͡° ͜ʖ ͡°)", "ಠ_ಠ", " ¯\\\\_(ツ)_/¯", "👍", "🐍"];
@kms70847
kms70847 / makegrid.py
Created Sep 19, 2019
makegrid.py - copy rectangular grids to the clipboard
View makegrid.py
from PIL import Image, ImageDraw
import sys
from io import BytesIO
from ctypes import memmove, windll, c_size_t as SIZE_T
from ctypes.wintypes import UINT, LPVOID, BOOL, HWND, HANDLE
HGLOBAL = HANDLE
GHND = 0x0042
GMEM_SHARE = 0x2000
@kms70847
kms70847 / MakingFilesImportableAnywhere.txt
Last active Dec 17, 2019
The Simplest Possible Way To Make A Python File Into A Package That's Importable From Anywhere
View MakingFilesImportableAnywhere.txt
The Simplest Possible Way To Make A Python File Into A Package That's Importable From Anywhere
~~~ A Guide For (And By) the Incurably Befuddled ~~~
==============================================================================================
SCENARIO: while writing a one-shot project, you construct a module named LovelyCoconut.py.
#main.py
import LovelyCoconut
LovelyCoconut.bang_halves_together()
@kms70847
kms70847 / GifHider.bookmarklet
Last active Jul 26, 2019
Gif Hider - replaces gifs with a black rectangle until you hover over them
View GifHider.bookmarklet
javascript:(function(){style = document.createElement("style"); style.stype = "text/css"; style.innerHTML = 'img[src$=".gif"]{filter: brightness(0%);} img[src$=".gif"]:hover{filter: brightness(100%);}'; document.getElementsByTagName("HEAD")[0].appendChild(style);})();
@kms70847
kms70847 / geometry.py
Created Jul 12, 2019
random generation of points in an equilateral triangle without conditionals or discarding out-of-bounds points
View geometry.py
import math
class Point(object):
def __init__(self, *args, **kargs):
self.num_dimensions = kargs.get("num_dimensions", len(args))
self.coords = [0 for i in range(self.num_dimensions)]
for i in range(len(args)):
self.coords[i] = args[i]
"""Gives the distance from this point to the origin."""
View float_visualizer_textual.py
import struct
import math
import decimal
from fractions import Fraction
def float_to_bits(f):
bits = [(b>>i)%2 for b in struct.pack(">d", f) for i in range(7, -1, -1)]
return "".join(str(b) for b in bits)
def bits_to_float(bits):