Skip to content

Instantly share code, notes, and snippets.

@metaist
metaist / chatgpt-dl.js
Created February 6, 2024 13:47
ChatGPT Download Bookmarklet
View chatgpt-dl.js
javascript: function h(html) {
return html
.replace(/<li>[^<]*?<p>/g, "<p>1. ")
.replace(/<pre>[^<]*<div .+?<\/div>/g, "")
.replace(/<ol start="(\d+)">[^<]*?<li>/g, "\n\n$1. ")
.replace(/<ol>/g, "\n")
.replace(/<p>/g, "\n\n")
.replace(/<\/p>/g, "")
.replace(/<b>/g, "**")
.replace(/<\/b>/g, "**")
@metaist
metaist / add-disk.sh
Created June 15, 2023 15:53
Add and format a non-boot disk
View add-disk.sh
#!/usr/bin/env bash
MOUNT_DIR=/mnt/data
DEVICE_NAME=/dev/$(lsblk | grep disk | tail -n1 | awk '{print $1}')
VERSION="0.1.0"
USAGE="\
Usage: add-disk.sh [--help | --version]
[--mount DIR] [--dev DEVICE]
@metaist
metaist / srt2txt.py
Created June 6, 2023 20:07
Convert a subtitle file into a transcript.
View srt2txt.py
#!/usr/bin/env python
"""Convert a subtitles file into a transcript.
Usage: srt2txt.py [-h] [--version]
[-i FILE] [-o FILE]
[--md]
Options:
-h, --help show this message and exit
--version show version and exit
@metaist
metaist / index.html
Created March 22, 2018 17:17
Banana or Not?
View index.html
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
</head>
<body>
<nav>
<div class="nav-wrapper">
<a href="#" class="brand-logo">Banapple</a>
@metaist
metaist / amazon-wishlist.js
Created July 31, 2017 03:26
Extract title, author, price, and audible information from your Amazon Wishlist.
View amazon-wishlist.js
var results = [];
var urls = [];
if (typeof jQuery=='undefined') {
script = document.createElement( 'script' );
script.src = 'https://code.jquery.com/jquery-3.2.1.min.js';
script.onload=getTitles;
document.body.appendChild(script);
} else {
getTitles();
@metaist
metaist / video-speed.html
Last active February 13, 2017 19:36
HTML5 Video Speed Bookmarklet
View video-speed.html
javascript:(function(){ window.rate = prompt('Enter playback rate.', window.rate||1) || window.rate || 1; Array.from(document.getElementsByTagName('video')).forEach(function(d) {d.playbackRate = window.rate})})();
@metaist
metaist / namespace.py
Created April 14, 2016 02:27
Manage flexible dicts in python.
View namespace.py
#!/usr/bin/env python
# coding: utf-8
'''Manage namespaces.'''
# Native
import collections
# <dict> shorthand
_del = dict.__delitem__
View todo.tmLanguage
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>todo</string>
</array>
<key>name</key>
<string>TODO</string>
View svg-gotchas.markdown

<text> look too bold?

text { 
  stroke: none;
  fill: #000;

}

@metaist
metaist / .bashrc
Last active September 2, 2015 18:50
Better virtualenv activate.
View .bashrc
# Show virtual environment (if any) and git branch (if any; requires .git-prompt.sh).
source ~/.git-prompt.sh
__blank="\[\e]0;\w\a\]\n" # white
__virtualenv=`basename "$VIRTUAL_ENV"`
__userhost="\[\e[32m\]\u@\h" # green
__pwd="\[\e[33m\]\w" # yellow
__cursor="\[\e[0m\]\n\$ " # white
export PS1="${__blank}${__virtualenv:+$__virtualenv }${__userhost} ${__pwd}\$(__git_ps1)${__cursor}"