Skip to content

Instantly share code, notes, and snippets.

@dotHTM
dotHTM / Shuffle Checkout Albums.scpt
Last active December 12, 2022 21:34
Shuffle Checkout Albums.scpt
property sourcePlaylistName : "Checkout"
property destinationPlaylistName : "ShuffleScript"
on run
tell application "Music"
set checkoutPlaylist to user playlist sourcePlaylistName
set checkoutTracks to tracks of checkoutPlaylist whose enabled is true
set checkoutAlbums to album of tracks of checkoutPlaylist whose enabled is true
set ddCA to my dedupe(checkoutAlbums)
get {count of checkoutAlbums, count of ddCA, ddCA}
@dotHTM
dotHTM / baseNdivis.calca
Created April 13, 2020 16:48
Base N sequence Division
Inspired from <https://mathhombre.tumblr.com/post/615224889029345280>
## A few examples
987654321 / 123456789 => 8
987654321 mod 123456789 => 9
987654321 - 9 => 987,654,312
0o7654321 in dec => 2,054,353
@dotHTM
dotHTM / Shiny rate Calca.md
Created November 28, 2019 00:26
How many battles to get a shiny Pokemon?

rate mult(battles) = if battles < 50 then 1 else if battles < 100 then 2 else if battles < 200 then 3 else if battles < 300 then 4 else if battles < 500 then 5 else 6

base rate= 1/4096

@dotHTM
dotHTM / shinyPokemonCalc.swift
Created November 26, 2019 20:48
How many battles does it take to get a shiny Pokemon?
#!/usr/bin/swift
import Foundation
// How many licks does it take to get to the center of a Tootsie Roll Pop?
// According to https://www.newsweek.com/pokemon-sword-shield-shiny-hunting-rates-brilliant-chain-fishing-1473370
let baseRate = 1.0/4096.0
// and...
func rateMultiplier(haveBattled: Int) -> Double {
%YAML 1.2
---
name: heredocPython
file_extensions:
- py
- py3
- pyw
- pyi
- pyx
- pyx.in

url encoded:

javascript:function%20markAds%28%29%20%7B%0Avar%20adsFound%20%3D%200%3B%0Avar%20nonAdsFound%20%3D%200%3B%0AarticleList%20%3D%20document.querySelectorAll%28%22article%22%29%0AarticleList.forEach%28%0Afunction%28someArticle%29%20%7B%0AsomeArticle.querySelectorAll%28%22span%22%29.forEach%28%0Afunction%28someNode%29%20%7B%0Aif%20%28someNode.textContent.indexOf%28%22Promoted%22%29%20%21%3D%3D%20-1%29%20%7B%0AadsFound%20%2B%3D%201%3B%0Aif%20%28someArticle%20%21%3D%3D%20null%20%26%26%20someArticle.parentNode%29%20%7B%20someArticle.style.background%20%3D%20%22lime%22%20%7D%0A%7D%20else%20%7B%0AnonAdsFound%20%2B%3D%201%3B%0A%7D%0A%7D%29%0A%7D%29%0Aconsole.log%28%22nonAdsFound%3A%20%22%20%2B%20nonAdsFound%20%2B%20%22%2C%20adsFound%3A%20%22%20%2B%20adsFound%29%3B%0A%7D%0AmarkAds%28%29%3B

url decoded & jspretty'd:

javascript: function markAds() {
f(x) = x^3 - 5 x^2 - 29 x + 105
g(theta) = abs( 1 - ( t / 4 ) )
unit circle(theta) = 1
parametic divistions = 50
parametic min = -5
parametic max = 10
x parametic = map( a * ( parametic max - parametic min)/parametic divistions + parametic min, a = 0 .. parametic divistions )
y parametic = map( x^2, x parametic )
sign(x) = |x| / x
sign(5) => 1
sign(-5) => -1
power = 2 # try adjusting this
epsilon = 10^-(power)
gtezero(x) = ( ( sign(x) + 1 ) / 2 )^(epsilon)
nwo(X)=reduce(x+y,map(1,X))
increment (n) = map( x , 1..n )
lo (pos,change) = if pos < change then 1 else 0
ro (pos,change) = if pos < change then 0 else 1
left ones (length, change) =
#!/usr/bin/env bash
convert source.png lower.jpg
flation(){
convert lower.jpg -resize 107% lower.jpg
}
quality(){