Skip to content

Instantly share code, notes, and snippets.

View parsingphase's full-sized avatar

Richard George parsingphase

View GitHub Profile

Keep volatile metadata and output stanzas out of .ipynb files in git:

.git/config contains

[filter "remove-notebook-output"]
    clean = "jupyter nbconvert --ClearOutputPreprocessor.enabled=True --ClearMetadataPreprocessor.enabled=True --to=notebook --stdin --stdout --log-level=ERROR"

.git/info/attributes contains

@parsingphase
parsingphase / biggerMastodonEmoji.css
Created January 30, 2025 01:06
Larger Emoji on Mastodon Web Interface
.edit-indicator__content .emojione,
.reply-indicator__content .emojione,
.status__content .emojione {
margin: -3px 0 0;
height: 40px !important;
width: auto !important;
}
@parsingphase
parsingphase / bluesky-mark-underscribed-images.css
Last active January 29, 2025 23:34
User Stylesheet for Bluesky to make images without alt text more visible
/*
This stylesheet is designed to give you a view of how many posts in your Bluesky feed lack alt-text.
It looks kinda ugly - it's supposed to - but if you just want the fade effect without the red frame,
delete the lines starting with border, width or height
How you use it depends on your browser.
For Safari, save this file somewhere then select that file in Safari -> Settings -> Advanced Stylesheet
For Firefox, try a plugin like https://addons.mozilla.org/en-US/firefox/addon/styl-us/
For Chrome or Vivaldi, try https://chromewebstore.google.com/detail/stylus/clngdbkpkpeebahjckkjfobafhncgmne
@parsingphase
parsingphase / bluesky-disable-load-button.css
Created November 28, 2024 02:57
Bluesky disable "load new posts" button
/* Use with a "custom CSS" browser extension such as https://addons.mozilla.org/en-US/firefox/addon/styl-us/ for firefox */
[aria-label='Load new posts'] {
display: none;
}
@parsingphase
parsingphase / bluesky-replies-only.css
Created November 14, 2024 22:47
User Stylesheet to only view replies on your Bluesky notification page (no follows, likes, reposts)
/*
This stylesheet can be used to hide all but reply notifications on your Bluesky notifications page (https://bsky.app/notifications)
You'll generally need a plugin such as https://addons.mozilla.org/en-US/firefox/addon/styl-us/ on firefox -
other plugins or ways of adding a user stylesheet are available for other browers.
You'll probably only want to enable it on the one page, and you'll have to turn it off to see any other notification types.
This stylesheet will work until something critical changes on the Bluesky notifications page.
If it breaks, the [data-testid="notificationsScreen"] line is the most likely culprit - you can just remove it & the matching {}s
*/
@parsingphase
parsingphase / mastodon-pics-no-description.css
Last active November 23, 2022 22:29
CSS to make un-described images more evident
/*
* Use this CSS either as a browser stylesheet or, if you run your own instance, as Site Custom CSS, to
* make images without alt-text obvious in your web interface.
*
* Hover over any obscured image to view it normally.
*
* Safari user stylesheet: Safari -> Settings -> Advanced Stylesheet
* Chrome / Firefox: see https://www.thoughtco.com/user-style-sheet-3469931
* Mastodon (v4) admin: Preferences -> Administration -> Appearance -> Custom CSS
*/
@parsingphase
parsingphase / sum-sigs.py
Last active June 25, 2020 09:11
Petitions.parliament.uk counter script
#!/usr/bin/env python3
import json
file_path = '241584.json'
with open(file_path, 'r') as f:
data = json.loads(''.join(f.readlines()))
sbyc = data['data']['attributes']['signatures_by_country']
@parsingphase
parsingphase / script-tags.js
Last active July 22, 2016 10:22
List script tags bookmarklet
javascript:(function () { var ss = [], sc = {}, dc = 0, hs = false; $("script[src]").each(function (i, tag) { var s = $(tag).attr('src'); if (!sc.hasOwnProperty(s)) { sc[s] = 0; } sc[s]++; ss.push(s); }); console.log(ss.length + ' script tags present on ' + document.URL + " \n\n" + ss.sort().join("\n")); for (var i in sc) { if (sc.hasOwnProperty(i)) { if (sc[i] > 1) { if (!hs) { console.log('** Duplicates: **'); hs = true; } dc++; console.log(i + ' seen ' + sc[i] + ' times'); } } } window.alert(ss.length + ' script URLs listed in console including ' + dc + ' duplicates');})();
@parsingphase
parsingphase / bountyHunterName.php
Last active February 18, 2016 12:28
Accidental Star Wars Name Generator
<?php
function generateJediName($words = 2)
{
$vowels = ['a', 'e', 'i', 'o', 'u'];
$parts = [];
for ($i = 0; $i < $words; $i++) {
$parts[$i] = chr(rand(65, 90)); // upper case
$wordLength = rand(4, 7);
for ($j = 0; $j < ($wordLength - 1); $j++) {
@parsingphase
parsingphase / .bash_profile
Created February 2, 2016 09:17
Bash profile with switching functions to use multiple homebrew versions of PHP.
export PS1="\u@rgmac:\w $ "
export PATH=/Users/richardg/Library/Python/2.7/bin/:$PATH
export PATH_DIST_PHP=$PATH
function setPhp56 {
export PATH=/usr/local/Cellar/php56/5.6.17/bin:$PATH_DIST_PHP
php --version
}
function setPhp7 {