Skip to content

Instantly share code, notes, and snippets.

@salif
salif / README.md
Last active August 26, 2023 23:44
Alegreya font for WriteFreely (Normal+Bold+Italic)
View README.md

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
View README.md

Example

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

Memrise - Sort courses by length / amount of words

  • Go to app.memrise.com/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
Created July 22, 2022 10:27
Linux Esperanto locales
View script.sh
mkdir -p /tmp/eo_locale
find /usr/share/locale/eo/LC_MESSAGES/ -name '*.mo' | xargs -I "{}" sh -c "msgunfmt {} >> /tmp/eo_locale/\$(basename {})"
cd /tmp/eo_locale
@salif
salif / console-script.js
Created July 16, 2022 21:27
Clear Memrise List; Remove all words
View console-script.js
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
View README.md

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
View get_json.js
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
}
}
View keybase.md

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:

@salif
salif / README.md
Created June 15, 2021 15:48
Calibre | Replace Liberation font with different font on Arch Linux
View README.md

Remove ttf-liberation

sudo -i
pacman -Rdd ttf-liberation
rm /usr/share/calibre/fonts/liberation/Liberation*.ttf

Option 1: noto-fonts

@salif
salif / sort.kt
Created May 29, 2021 18:21
Kotlin sort Array<Int>
View sort.kt
fun sort(array: Array<Int>): Array<Int> {
when {
array.size == 1 -> {
return array
}
array.size <= 2 -> {
val left = array[0]
val right = array[1]
return if (right < left) {
arrayOf(right, left)