Skip to content

Instantly share code, notes, and snippets.

View savkov's full-sized avatar

Sasho Savkov savkov

View GitHub Profile
@savkov
savkov / set_slack_status.py
Created September 17, 2019 09:44
Set some attributes of your slack profile automatically.
from slacker import Slacker
import os
def yellow(s):
return '\033[93m' + str(s) + '\033[0m'
try:
# How to obtain a legacy token: https://get.slack.help/hc/en-gb/articles/215770388-Create-and-regenerate-API-tokens
slack = Slacker(os.environ.get('SLACK_TOKEN'))
except:
@savkov
savkov / download-ipa.py
Last active August 5, 2022 05:21
Download IPA transcriptions from Wiktionary
import requests
from bs4 import BeautifulSoup
from tqdm import tqdm
def get_ipa(html):
soup = BeautifulSoup(html, 'html5lib')
ipa_spans = soup.findAll('span', {'class': 'IPA'})
return [span.text[1:-1] for span in ipa_spans]
@savkov
savkov / tex-conversions.py
Last active September 22, 2015 09:35 — forked from yourcelf/tex-conversions.py
Convert utf-8 encoded unicode characters to latex escape sequences. I use this for pre-processing bibtex exports from zotero. Usage: tex-conversions.py infile > outfile
# Obtained from http://code.activestate.com/recipes/252124-latex-codec/
latex_equivalents = {
0x0009: ' ',
0x000a: '\n',
0x0023: '{\#}',
0x0026: '{\&}',
0x00a0: '{~}',
0x00a1: '{!`}',
0x00a2: '{\\not{c}}',
0x00a3: '{\\pounds}',