Skip to content

Instantly share code, notes, and snippets.

@antonalekseev
antonalekseev / absplit.sh
Created January 11, 2021 00:34
Split audiobook into files containing individual chapters
#!/bin/bash
# Description: Modified version of script from https://unix.stackexchange.com/a/612124
# Requires: ffmpeg, jq
# Author: Hasan Arous
# License: MIT
in="$1"
out="$2"
splits=""
while read start end title; do
@antonalekseev
antonalekseev / search-json-mozlz4-to-vimium.txt
Last active December 15, 2019 18:35
Convert firefox search engines to format used by vimium
# Convert firefox search engines to format used by vimium
# Get mozlz4a from https://gist.github.com/Tblue/62ff47bef7f894e92ed5
mozlz4a -d search.json.mozlz4 search.json
jq -r '.engines[] | [ ._metaData.alias + ":" , ( [._urls[] | select(.template | contains("searchTerms")) ][0].template | if . == null then "none" else . end | sub("{searchTerms}"; "%s") ), ._name ] | join(" ")' < search.json
@antonalekseev
antonalekseev / black_code_prettify.json
Created October 29, 2019 18:51 — forked from MarvinT/black_code_prettify.json
json you can paste into jupyter notebook's code prettify configuration that makes it use black to reformat your code instead of yapf.
{
"python": {
"library": "import json\ndef black_reformat(cell_text):\n import black\n import re\n cell_text = re.sub('^%', '#%#', cell_text, flags=re.M)\n try:\n reformated_text = black.format_str(cell_text, 88)\n except TypeError:\n reformated_text = black.format_str(cell_text, mode=black.FileMode(line_length=88))\n return re.sub('^#%#', '%', reformated_text, flags=re.M)",
"prefix": "print(json.dumps(black_reformat(u",
"postfix": ")))"
},
"r": {
"library": "library(formatR)\nlibrary(jsonlite)",
"prefix": "cat(toJSON(paste(tidy_source(text=",
"postfix": ", output=FALSE)[['text.tidy']], collapse='\n')))"
#!/bin/sh
PATH=/usr/local/bin/:$PATH
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install twpayne/taps/chezmoi
# on Mojave fix merged into homebrew will suffice, but on High Sierra should
# install from antonalekseev/homebrew-tap
# see also https://github.com/lastpass/lastpass-cli/issues/427#issuecomment-446779116
brew install --build-from-source https://raw.githubusercontent.com/antonalekseev/homebrew-tap/master/lastpass-cli.rb
#!/bin/bash
set -uo pipefail
hostname="archlinux"
user="user"
password="secret"
device_list=$(lsblk -dplnx size -o name,size,type|grep -Ev 'boot|rom|loop'|tr -s '[:space:]'|cut -d' ' -f1,2|paste -s -)
device=$(dialog --stdout --menu "Select installation disk" 0 0 0 ${device_list}) || exit 1

Keybase proof

I hereby claim:

  • I am antonalekseev on github.
  • I am antonalekseev (https://keybase.io/antonalekseev) on keybase.
  • I have a public key whose fingerprint is 25F9 B5B9 E7EE FA74 777A DF34 DA45 1231 1E49 A43C

To claim this, I am signing this object:

from aqt import mw
from aqt.reviewer import Reviewer
from aqt.deckconf import DeckConf
from aqt.forms import dconf
from anki.hooks import addHook, wrap
from PyQt4 import QtGui
from threading import Timer
def MydefaultEase(self):
if self.typedAnswer == self.typeCorrect:
# Addon "Select_Buttons_Automatically_For_Cloze_Type_Cards.py"
# Amendments by Stefan Zeh to the addon mentioned below.
# 2016-12-07
# If you have the "type" option in a cloze deletion card, this addon will
# automatically select the "good" button upon hitting <return> if your typedAnswer has been correct (otherwise "bad" is selected).
# It ignores html markup (e.g. color) in the deposited correct answer so it works better than a previous addon (see below "Inspired by..").
# [I marked feminin answers in red and maskuline answers in blue (e.g. "une table" in red, "un copain" in blue) and the
# addon below did not work any more. This one is ok as it only compares plain text to select the button (or "ease level").]
# Inspired by
- redisplay_internal (C function) 2625 44%
+ eval 2514 42%
undo-tree-update-menu-bar 24 0%
menu-bar-update-buffers 7 0%
+ #<compiled 0x41e1709f> 7 0%
+ keymap-canonicalize 5 0%
- timer-event-handler 2213 37%
- apply 2193 37%
- treemacs--follow 1939 32%
- file-truename 1580 26%
@antonalekseev
antonalekseev / file.json
Created January 9, 2019 17:17
python-json-format created by antonalekseev - https://repl.it/@antonalekseev/python-json-format
{ "value": [1, 2, 3, 4, 5] }