Skip to content

Instantly share code, notes, and snippets.

@jbroadway
jbroadway / Slimdown.md
Last active February 5, 2024 10:43
Slimdown - A simple regex-based Markdown parser.
@gruber
gruber / Liberal Regex Pattern for Web URLs
Last active April 22, 2024 19:02
Liberal, Accurate Regex Pattern for Matching Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s
@auneri
auneri / website.html
Last active June 28, 2021 09:14
Better motherfucking website template.
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
h1, h2, h3 {
line-height: 1.2;
}
body {
margin: 40px auto;
max-width: 650px;
@eevee
eevee / gist:55426e5856f5825317b1
Last active January 28, 2021 22:51
adblock rules to hide mentions from people who don't follow you

Pop open "filter preferences" in adblock plus, and add the following rules to hide mentions from people who don't follow you (and who you don't follow).

For the interactions/notifications page:

twitter.com##.interaction-page [data-follows-you="false"][data-you-follow="false"]:not(.my-tweet)

For the mentions page:

twitter.com##.mentions-page [data-follows-you="false"][data-you-follow="false"]:not(.my-tweet)
@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter
@fnky
fnky / ANSI.md
Last active May 7, 2024 09:24
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@mouse-reeve
mouse-reeve / fizzbuzz.py
Last active April 22, 2022 06:33
Fizzbuzz via answers.com
''' we're solving fizzbuzz with a little help from the web '''
from html.parser import HTMLParser
from urllib.request import Request, urlopen
import re
import time
base_url = 'https://www.answers.com/Q/'
tag_name = 'div'
class_name = 'answer-body'
delimiter = '_'
@FiXato
FiXato / Mastodon-indicate_undescribed_media_with_borders-subtler.user.css
Last active March 7, 2024 18:29
CSS user style to add a red border around media (images, audio, video and animated 'gifv') that lacks a description. Based on code by Paul: https://linernotes.club/@balrogboogie
/* indicate media without a description
initial code by Paul (https://linernotes.club/@balrogboogie), expanded upon by FiXato (https://contact.fixato.org)
related discussions: https://dragonscave.space/@Mayana/106443499687608116.
Feel free to reuse it; it's public domain (https://linernotes.club/@balrogboogie/106681622019395866) */
.media-gallery__item-thumbnail img:not([alt]),
.audio-player__canvas:not([title]),
.video-player video:not([title]),
.media-gallery__gifv video:not([title])
{
border: 1px dashed rgba(255, 0, 0, 0.5);
@dannypage
dannypage / twitter_font_adblock.txt
Created August 24, 2021 21:44
How to block Twitter's terrible font
# Go to uBlock's options and paste in the following under the "My Filters" tab
https://abs.twimg.com/fonts/chirp-bold-web.woff
https://abs.twimg.com/fonts/chirp-heavy-web.woff
https://abs.twimg.com/fonts/chirp-regular-web.woff
https://abs.twimg.com/fonts/v2/chirp-bold-web.woff
https://abs.twimg.com/fonts/v2/chirp-heavy-web.woff
https://abs.twimg.com/fonts/v2/chirp-medium-web.woff
https://abs.twimg.com/fonts/v2/chirp-regular-web.woff
@sneakers-the-rat
sneakers-the-rat / clean_pdf.sh
Last active February 14, 2024 16:52
Strip PDF Metadata
# --------------------------------------------------------------------
# Recursively find pdfs from the directory given as the first argument,
# otherwise search the current directory.
# Use exiftool and qpdf (both must be installed and locatable on $PATH)
# to strip all top-level metadata from PDFs.
#
# Note - This only removes file-level metadata, not any metadata
# in embedded images, etc.
#
# Code is provided as-is, I take no responsibility for its use,