Skip to content

Instantly share code, notes, and snippets.

@metaist
metaist / chatgpt-dl.js
Created February 6, 2024 13:47
ChatGPT Download Bookmarklet
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 / bootstrap-vertical-grid.css
Created November 24, 2013 21:06
Bootstrap vertical grid. For laying out full-screen fixed height webapps.
.container-fixed {
bottom: 0;
position: fixed;
left: 0;
right: 0;
top: 0;
}
.container-fixed .col {
height: 100%;
@metaist
metaist / add-disk.sh
Created June 15, 2023 15:53
Add and format a non-boot disk
#!/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.
#!/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 / Standalone-Chrome-Apps.markdown
Created September 18, 2014 15:35
Building, installing, and running a Standalone Chrome App

Build, Install, and Run a Chrome App without Chrome

Until [app_shell] is created, here is a workaround for building, installing, and running a standalone [Chrome App] for Windows.

Step 1 - Pack Your Chrome App

  1. Use chrome://extensions to package your app. The approach we're outlining here doesn't work for unpacked apps.
  2. You should have a .crx file that is your packaged app.
@metaist
metaist / jsonwiki.py
Created June 7, 2013 14:32
Convert tables from Wikipedia into JSON.
#!/usr/bin/env python
"""Convert tables from Wikipedia into JSON."""
import argparse
import json
import sys
from bs4 import BeautifulSoup
import requests
@metaist
metaist / google-docs.ahk
Created March 12, 2013 00:13
Control Google Docs using AutoHotKey.
; Google Docs Utility Functions
SavePDF(filename) {
SendInput,!f
Sleep,200
SendInput,d
Sleep,200
SendInput,{Down}
Sleep,200
SendInput,{Down}
@metaist
metaist / index.html
Created March 22, 2018 17:17
Banana or Not?
<!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.
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 / object-filter.js
Created March 19, 2014 02:32
Add .filter to JavaScript objects.
// Based on: http://stackoverflow.com/a/5072145/12815
Object.filter = function(obj, predicate) {
var result = {}, key;
for(key in obj) {
if (obj.hasOwnProperty(key) && predicate.call(obj, key, obj[key])) {
result[key] = obj[key];
}//end if: key added to result
}//end for: iterated over the object
return result;