Skip to content

Instantly share code, notes, and snippets.

View met's full-sized avatar

Martin Hassman met

View GitHub Profile
#
# SM2_mnemosyne.py <Peter.Bienstman@UGent.be>
#
import time
import random
import calendar
import datetime
from mnemosyne.libmnemosyne.translator import _
@met
met / sched.py
Created July 6, 2018 21:51
Spaced Repetition implementation from Anki project https://github.com/dae/anki/blob/master/anki/sched.py (look for "Answering a review card" and "Interval management")
# -*- coding: utf-8 -*-
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
from __future__ import division
import time
import random
import itertools
from operator import itemgetter
from heapq import *
@met
met / Sched.java
Created July 6, 2018 21:58
Spaced Repetition Implementation from AnkiDroid project https://github.com/ankidroid/Anki-Android/blob/master/AnkiDroid/src/main/java/com/ichi2/libanki/Sched.java (look for "Answering a review card" and "Interval management")
/****************************************************************************************
* Copyright (c) 2011 Norbert Nagold <norbert.nagold@gmail.com> *
* Copyright (c) 2012 Kostas Spyropoulos <inigo.aldana@gmail.com> *
* Copyright (c) 2013 Houssam Salem <houssam.salem.au@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General private License as published by the Free Software *
* Foundation; either version 3 of the License, or (at your option) any later *
* version. *
* *
@met
met / sm_backup.js
Last active March 7, 2019 21:53
Backup of Supermemo.com to TSV (on page with Course editor choose Change Order and run this script in console, it will export only selected section of selected course)
(function() {
var dataPole=[];
document.querySelectorAll(".course-editor-browser-page-item").forEach(
function(line) {
var c1=line.querySelectorAll("div.page-item-content")[0].querySelector("div").innerText;
var c2=line.querySelectorAll("div.page-item-content")[1].querySelector("div").innerText;
/* transform enters */
c1 = c1.replace(/\n/g,"\\n");
c2 = c2.replace(/\n/g,"\\n");
@met
met / ReadNumbers
Created November 8, 2019 14:46
Language training. Listen to numbers in different voices. AppleScript.
# Different names for voices (you need to download them in macos settings)
# British: Daniel, Kate, Oliver, Serena
# Scotland: Fiona
# USA: Albert, Alex, Agnes, Kathy, Susan
# Australia: Karen, Lee
# Irland: Moira
# South Africa: Tessa
set voicesnames to {"Daniel", "Kate", "Oliver", "Serena", "Fiona", "Karen", "Lee", "Moira", "Tessa", "Albert", "Alex", "Agnes", "Kathy", "Susan"}
@met
met / Lua-idioms.md
Last active August 6, 2020 18:42
Lua idiomy

Lua idiomy

Idiomy jsou konstrukce, které se neřeší logikou, ale naučením. Ty první číslované pochází z oficiální knihy Roberto Ierusalimschy: Programming in Lua, 4th edition.

1. Defaultní hodnota proměnné

x = x or value

Je obdobou zápisu if not x then x = value Pokud hodnota x nemá hodnotu, přiřadí jí výchozí hodnotu value. Nefunguje správně, pokud má x hodnotu false.

@met
met / remove_viet_accent
Created June 26, 2018 21:51
Remove Vietnamese accent in Google Spreadsheets
=REGEXREPLACE(REGEXREPLACE(REGEXREPLACE(REGEXREPLACE(REGEXREPLACE(REGEXREPLACE(REGEXREPLACE(REGEXREPLACE(LOWER(A1);"[áàãảạâấầẫẩậăắằẵẳặ]";"a");"[éèẽẻẹêếềễểệ]";"e");"[íìĩỉị]";"i");"[óòõỏọôốồỗổộ]";"o");"[ớờỡởợ]";"ơ"); "[úùũủụ]";"u");"[ứừữửự]";"ư");"[yýỳỹỷỵ]";"y")
@met
met / index.html
Last active January 11, 2021 18:25
JS Bin// source https://jsbin.com/pogigom find all text nodes inside "article p", exclude style, script etc.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<article>
@met
met / index.html
Last active January 11, 2021 18:26
JS Bin// source https://jsbin.com/defaliv replace some words inside textnode
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<article>
@met
met / WordStats.txt
Created January 25, 2021 16:14
All words from 1st episode of La Casa de Papel on Netflix an alphabetical order in 26 different languages
European Spanish
1033 11 12 1234 13 15 1600 17 19 20 2078 23 2400 26 27 30 300 3510 40 434 6 92 a abierta abierto abiertos abre abrir aceptado acojonaría acorazada acorralados acreditaciones acreditación activaremos adelante además adónde aficionado agente agua aguantas ah ahogo ahora ahí al alarma alarmas alcalá alejados algo alguna algunas algún alison allá allí alma amable amor analógica anillo antecedentes anterior antes apareció aparezca apenas apoyo aprendo apuntarle apuntas apuntándole apágalo aquel aquí ariadna arma armados armas arriba arsenal artefactos arturito arturo asado asalto aseguro asesina asturias así atenta aterrada atracadores atraco atracos atrás avilés ay ayer ayudarte años baja bajad bajes bala banda barco bañarte berlín bien bienvenida bigote billete billetes bobinas boca bocajarro boda bolsas bomba bonita borras buen bueno buenos busca buscando busques cabeza cablear cabrones cada cae caer caerían cafetería cagan cago caja calidad caliente calla calle cama cambiar cambio camino camio