Skip to content

Instantly share code, notes, and snippets.

View askoufis's full-sized avatar

Adam Skoufis askoufis

View GitHub Profile
askoufis /
Created September 7, 2017 13:21
Pulls kaomoji from into a text file that can be parse by the Google Japanese IME. Taken from and added a few lines to make it work for me.
# encoding=utf-8
from bs4 import BeautifulSoup
import requests
import sys
soup = BeautifulSoup(requests.get("").text, "html.parser")
kaomojis = filter(None, ['かおもじ\t'+i.getText()+'\t顔文字' if '\n' not in i.getText() else None for i in soup.find_all('span', class_='kaomoji')])
askoufis /
Created April 11, 2018 05:26
Bash retry function with exponential backoff
# Retry a command with exponential backoff
function retry {
local maxAttempts=$1
local secondsDelay=1
local attemptCount=1
local output=
shift 1
askoufis /
Created January 14, 2019 10:09
Anki 2.1 tag toggler
from aqt import mw
from aqt.reviewer import Reviewer
class TagTogglerReviewer(Reviewer):
# Keep Python from complaining that self.shortcuts doesn't exist.
shortcuts = []
def __init__(self, mw):