Skip to content

Instantly share code, notes, and snippets.

View salif's full-sized avatar

Salif Mehmed salif

View GitHub Profile
@salif
salif / bookmarklet.js
Created June 5, 2024 17:44
bookmarklet to open video in new tab/downloading
javascript:(function (w) {var vs = Array.from(w.document.body.querySelectorAll("video"));if (vs.length === 0) {w.document.querySelectorAll("iframe").forEach(vif => {vif.contentDocument?.body.querySelectorAll("video").forEach(vi => {vs.push(vi);});});};if (vs.length === 0) {w.alert("no videos!");} else {var v = vs.length === 1 ? vs[0]?.currentSrc : vs[w.Number.parseInt(w.prompt(vs.map((vv, ind) => ind + ": " + vv.currentSrc).join("\n"), "0"), 10)]?.currentSrc;if (v?.length > 0) { w.open(v, "_blank"); } else { w.alert("video src is empty!"); }};})(window);
@salif
salif / patch-gleam-format.sh
Last active July 29, 2024 15:16
Patch the Gleam formatter to fix the indentation. For the Arch Linux PKGBUILD.
# git clone https://aur.archlinux.org/gleam.git
pkgver="1.0.0"
EDITOR=${EDITOR:-micro}
makepkg --nobuild
cd src/
cp -r gleam-$pkgver gleam-$pkgver-new
$EDITOR gleam-$pkgver-new/compiler-core/src/format.rs
# - const INDENT: isize = 2;
@salif
salif / README.md
Last active August 26, 2023 23:44
Alegreya font for WriteFreely (Normal+Bold+Italic)

Alegreya font for WriteFreely (Normal+Bold+Italic)

Choose style.css or style.min.css (minified css), copy its contents, and paste it into Custom CSS on Writefreely.

@salif
salif / README.md
Created November 14, 2022 18:26
Edit Markdown Table

Example

edit_markdown_table(`
|key|value|
|:-|-:|
|a|1|
|b|2|
|c|3|
`, [1, 0])
@salif
salif / README.md
Last active February 11, 2024 16:59
Memrise - Sort courses by length / amount of words

Memrise - Sort courses by length / amount of words

  • Go to app.memrise.com/community/courses
  • Open Developer tools and go to the Console tab
  • Copy the code from script.js from this gist, then paste it into the console and hit enter
  • Done!
@salif
salif / script.sh
Last active January 24, 2024 20:39
Linux grep locales
LANG=$(printf "$LC_MESSAGES" | cut -d '_' -f 1)
mkdir -p /tmp/${LANG}_locale
find /usr/share/locale/${LANG}/LC_MESSAGES/ -name '*.mo' | xargs -I "{}" sh -c "msgunfmt {} >> /tmp/${LANG}_locale/\$(basename {})"
grep -i -A 1 "" /tmp/${LANG}_locale/*.mo
@salif
salif / console-script.js
Created July 16, 2022 21:27
Clear Memrise List; Remove all words
var s_a;
function s_f() {
const s_b = document.querySelector('i[data-role="remove"');
if (s_b == undefined) {
clearInterval(s_a);
return;
}
s_b.click();
document.querySelector('a[tabIndex="4000"]').click();
}
@salif
salif / README.md
Created July 13, 2022 10:15
Transliterate a Web Page

Example

transliterate_page({ "Ĉ": "Cx", "Ĝ": "Gx", "Ĥ": "Hx", "Ĵ": "Jx", "Ŝ": "Sx", "Ŭ": "Ux", "ĉ": "cx", "ĝ": "gx", "ĥ": "hx", "ĵ": "jx", "ŝ": "sx", "ŭ": "ux" })

Before transliteration

Ĉiuliteraĵo
@salif
salif / get_json.js
Created February 22, 2022 23:37
Get JSON with all words from pbd171.db
const words = require('./temp.json')
const fs = require('fs')
for (let i = 0; i < words.length; i+=1904) {
const lcode = 'word_'+words[i].lan_code
for (let j = 0; j < 1904; j++) {
words[j][lcode] = words[i+j].word
}
}

Keybase proof

I hereby claim:

  • I am salif on github.
  • I am salifm_ (https://keybase.io/salifm_) on keybase.
  • I have a public key ASA-FPLiI7Tx156koKlscfJlcMU6md-SI-rznIAgb3b_9Ao

To claim this, I am signing this object: