Skip to content

Instantly share code, notes, and snippets.

@yanowitz
yanowitz / bookmarklet.js
Created February 22, 2023 22:42
put this in your toolbar as a bookmarklet to change video speed
javascript:window.__make_option=function(e){const n=document.createElement("option");return n.innerText=e,n.value=e,n},window.__make_control=function(e){const n=document.createElement("div"),o=document.createElement("select");return o.appendChild(window.__make_option(.5)),o.appendChild(window.__make_option(1)),o.appendChild(window.__make_option(.75)),o.appendChild(window.__make_option(1.25)),o.appendChild(window.__make_option(1.5)),o.appendChild(window.__make_option(1.75)),o.appendChild(window.__make_option(2)),o.selectedIndex=1,o.addEventListener("change",n=>{e(Number(n.target.value))}),n.appendChild(o),n.style.position="absolute",n.style.right="0",n.style.bottom="0",n.style.zIndex="9999",n},window.__init=function(){for(const e of document.querySelectorAll("video")){const n=e.parentElement,o=document.createElement("div");e.remove(),o.appendChild(e),o.appendChild(window.__make_control(n=>e.playbackRate=n)),n.appendChild(o)}},window.__init();
@yanowitz
yanowitz / sms-to-csv.sh
Created July 8, 2020 00:19 — forked from phx/sms-to-csv.sh
Dump iOS SMS/iMessage database to CSV.
#/bin/bash
# not an actual script - these are only commands, but the script would be basically the same.
# requires jailbroken iOS device
# get into the filesystem
ssh root:alpine@iphone
# update your package list, and install sqlite
apt-get update
@yanowitz
yanowitz / TrueColour.md
Created September 26, 2019 14:20 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)
@yanowitz
yanowitz / README.txt
Last active March 21, 2019 09:06
fixing https://imagetragick.com/ (CVE-2016–3714) on heroku
1. Create a directory/file in your deploy repo's root dir (e.g., .ImageMagic/policy.xml), commit it.
2. Set the following config var:
heroku config:set MAGICK_CONFIGURE_PATH=/app/.ImageMagick -a YOUR-APP-NAME
3. Deploy
4. heroku run bash -a YOUR-APP-NAME
5. run
convert -list policy
Path: [built-in]
Policy: Undefined
@yanowitz
yanowitz / sidekiq.rb
Last active April 21, 2016 00:27
defer sidekiq job enqueing until after activerecord transactions commit (config/initializers/sidekiq.rb). WARNING: this changes the semantics of sidekiq. Understand that before using :)
### WARNING -- On Sidekiq upgrade, make sure Sidekiq::Client still has this push interface
## note -- we also don't support Sidekiq.redis_pool'ing here -- which only matters if you are
## sharding Sidekiq jobs across several redis instances, which is not recommended...
# Also note -- Sidekiq test mode does an end-run around all this code...
module Sidekiq
class Client
def self.run_deferred_jobs
@yanowitz
yanowitz / gist:748561
Created December 20, 2010 16:06 — forked from nickyp/gist:451544
require 'nokogiri'
# \
# \
# \\
# \\
# >\/7
# _.-(6' \
# (=___._/` \
# ) \ |