Skip to content

Instantly share code, notes, and snippets.

Ad-free Twitter

Inject this css snippet to remove all ads from your Twitter timeline.

div[data-testid="placementTracking"]:has(path[d="M19.498 3h-15c-1.381 0-2.5 1.12-2.5 2.5v13c0 1.38 1.119 2.5 2.5 2.5h15c1.381 0 2.5-1.12 2.5-2.5v-13c0-1.38-1.119-2.5-2.5-2.5zm-3.502 12h-2v-3.59l-5.293 5.3-1.414-1.42L12.581 10H8.996V8h7v7z"]) {
  display: none;
}
using LinearAlgebra
# A utility for computing the unique invariant probability
# vector for a finite, time homogeneous, irreducible, and aperiodic Markov chain
# from its transition probability matrix.
function invariantProb(P)
PT = transpose(P)
left_eigenvectors = nullspace(PT - I)
normalized_left_eigenvector = left_eigenvectors[:, 1] / sum(left_eigenvectors[:, 1])
return normalized_left_eigenvector
@cmoog
cmoog / denoplot.ts
Last active May 25, 2023 22:49
Deno wrapper for using @observablehq/plot to generate SVG charts server-side
import { parseHTML } from "https://esm.sh/linkedom@0.14.25";
import * as ObservablePlot from "https://esm.sh/@observablehq/plot@0.6.7";
// @ts-ignore: bad type
const { document } = parseHTML(`<!DOCTYPE html><html lang="en"></html>`);
export const Plot: typeof ObservablePlot = {
...ObservablePlot,
plot: (options?: ObservablePlot.PlotOptions) => {
const elt = ObservablePlot.plot({ document, ...options });
#!/usr/bin/env bash
head $1 -n 1 | jq -r keys_unsorted | jq -cr 'join(",")' > $1.csv
jq -r 'join(",")' $1 >> $1.csv
@cmoog
cmoog / kindle-highlight-exporter.md
Last active December 12, 2022 21:00
Kindle highlight parser and exporter

Simple script to export highlights from a Kindle.

Requirments

  • macOS host
  • Kindle plugged into Mac
  • Deno installed on Mac

Usage

@cmoog
cmoog / facebook-ad-killer.js
Last active April 2, 2023 01:17
facebook ad killer for uBlockOrigin
/// facebook-hide-sponsored.js
(() => {
"use strict";
const INTERVAL = 1500;
setInterval(() => {
let element = Array.from(
document.querySelectorAll(
`span[style="-webkit-box-orient:vertical;-webkit-line-clamp:2;display:-webkit-box"]`
)
).find(({ innerHTML }) => innerHTML.trim() === "Sponsored");