Skip to content

Instantly share code, notes, and snippets.

@adtac
adtac / Dockerfile
Last active April 13, 2024 22:33
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@cemerson
cemerson / archive.org-scanned-book-downloader-bookmarklet.md
Last active April 24, 2024 18:53
Archive.org Scanned Book Downloader Bookmarklet

Archive.org Scanned Book Downloader Bookmarklet

A simple "1-click" javascript approach to downloading a scanned book from archive.org to read at your leisure on the device of your choosing w/out having to manually screenshot every pages of the book by hand. In short it's a glorified "Save Image As..." approach but consolidated down to "1 click". BTW there may be a much better option than this out there - I just built this as an autistic project to see if it would work.

Demo Video

Archive.org SBDL Demo

Obligatory Legal/Disclaimer:

By using this script you agree to delete all book files/images after your 1 hour or 14 days is up! I don't support using this script for any other use cases. After all, none of us have ever kept a library book past it's return date, right?

@rufoa
rufoa / patch.sh
Last active February 2, 2024 06:41
sublime merge 2 build 2068 linux
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
target="${1:-/opt/sublime_merge/sublime_merge}"
check_sha() {
local sha_valid
@qwerty12
qwerty12 / termux-url-opener
Last active July 7, 2023 07:40
Install the followig at least: VLC in Android, `jq`, Termux API, `youtube-dl`, `streamlink`, `gallery-dl` and `aria2c`
#!/data/data/com.termux/files/usr/bin/bash
if [ -z "${1:-}" ]; then
exit 1
fi
url_is_supported() {
REPLY=""
declare -A arr
case "$1" in
@coolreader18
coolreader18 / segfault.py
Last active March 30, 2024 08:05
CPython segfault in 5 lines of code
class E(BaseException):
def __new__(cls, *args, **kwargs):
return cls
def a(): yield
a().throw(E)

How to use this?

  1. Install the USB drivers for your device (Google has a list of some universal USB drivers here)
  2. Download the ADB binary for your particular OS (Windows, Mac, Linux)
  3. Extract the zip file into a folder that you can quickly access.
  4. On your phone, go to Settings and tap on About Phone. Find the Build Number and tap on it 7 times to enable Developer Options.
  5. Now enter Developer Options and find USB Debugging. Enable it.
  6. On your computer, browse to the directory where you extracted the ADB binary.
  7. Launch a Command Prompt in your ADB folder. For Windows users, this can be done by holding Shift and Right-clicking then selecting the “open command prompt here” option.
  8. Once you’re in the command
@sidneys
sidneys / giphy.direct-gif-image-download-button.js
Last active February 11, 2023 17:37
UserScript | GIPHY | Direct GIF Image Download Button
// ==UserScript==
// @name GIPHY | Direct GIF Image Download Button
// @namespace de.sidneys.userscripts
// @homepage https://gist.githubusercontent.com/sidneys/13433a0c726895597fb4571405c7ca15/raw/
// @version 0.9.1
// @description Adds a button for directly downloding the original GIF images to the side menu. Uses the given GIF title as the local filename.
// @author sidneys
// @icon https://giphy.com/static/img/favicon.png
// @include http*://giphy.com/gifs/*
// @require https://greasyfork.org/scripts/38888-greasemonkey-color-log/code/Greasemonkey%20%7C%20Color%20Log.js
# dvorak layout
loadkeys dvorak
export HOSTNAME=thinkpad
export DEVICE=/dev/sda
export EFI_PARTITION=/dev/sda1
export ROOT_PARTITION=/dev/sda2
# as root
timedatectl set-ntp true
Last login: Sat Jun 15 15:49:42 on ttys000

▶ [~] set -x > a.txt
+omz_termsupport_precmd:1> emulate -L zsh                                                           
+omz_termsupport_precmd:3> [[ '' == true ]]
+omz_termsupport_precmd:7> title '%15<..<%~%<<' %n@%m
+title:1> emulate -L zsh
+title:2> setopt prompt_subst
+title:4> [[ '' == *term* ]]