Skip to content

Instantly share code, notes, and snippets.

View BaksiLi's full-sized avatar
✍️
Wired-in ∨ Studying

Baksi BaksiLi

✍️
Wired-in ∨ Studying
View GitHub Profile
@BaksiLi
BaksiLi / undock.sh
Last active August 10, 2023 06:45
Docker command to kill and remove a container with its image
alias undock='f() {
if sudo docker kill $1; then
echo "[+] Successfully killed: $1"
else
echo "[-] Failed to kill: $1"
fi
if sudo docker rm $1; then
echo "[+] Successfully removed: $1"
else
@BaksiLi
BaksiLi / gist:c6a371bf770e8dd8a2c703ae5087d31e
Created February 17, 2023 02:53
Anki Python debug script to move "[sound:xxx]" between fields
note_type = 'Basic'
regex = r'\[sound:.*\]'
field_from = 'Back'
field_to = 'Pronunciation'
model = mw.col.models.by_name(note_type)
notes = mw.col.models.nids(model)
for nid in notes:
note = mw.col.get_note(nid)
@BaksiLi
BaksiLi / proxy.zsh
Last active May 21, 2022 11:06
zsh function for proxy and undo proxy
function check_install {
output="$($1 --version)"
output_size=${#output}
if [ $output_size -eq 0 ]; then
echo '0'
else
echo '1'
fi
}
@BaksiLi
BaksiLi / Barclays.list
Created February 16, 2022 08:59
Barclays domains used for DNS filtering (primarily on Surge)
# Barclays Mobile Banking
DOMAIN-SUFFIX,barclays.com
DOMAIN-SUFFIX,barclays.mobi
DOMAIN-SUFFIX,barclays.co.uk
DOMAIN-SUFFIX,barclays
DOMAIN-KEYWORD,barc.ly
DOMAIN-KEYWORD,bclays-ads
DOMAIN-KEYWORD,barclaysuk
# Other domains
@BaksiLi
BaksiLi / Revolut.list
Created February 11, 2022 10:52
Revolut domains used for DNS filtering (primarily on Surge)
# Revolut
DOMAIN-SUFFIX,revolut.com
DOMAIN-SUFFIX,revolutlabs.com
# assets.bwbx.io
# IP-CIDR,185.76.151.0/24,no-resolve
# IP-CIDR6,2001:b28:f23d::/48,no-resolve
@BaksiLi
BaksiLi / decryptpdf.sh
Created June 27, 2020 14:24
Decrypt PDF by password stored in the Spotlight comment
#!/bin/bash
# Decrypt PDF by password stored in the Spotlight comment.
read -d '' Script << EOF
tell application "Finder"
set Comm to comment of (POSIX file "$1" as alias)
end tell
return Comm
EOF
@BaksiLi
BaksiLi / preamble.txt
Created June 3, 2020 13:41
Communist Manifesto Preamble
Preamble
A spectre is haunting Europe—the spectre of Communism.
All the Powers of old Europe have entered into a holy alliance to exorcise this spectre: Pope and Czar, Metternich and Guizot, French Radicals and German police-spies.
--------
Where is the party in opposition that has not been decried as Communistic by its opponents in power? Where is the Opposition that has not hurled back the branding reproach of Communism, against the more advanced opposition parties, as well as against its reactionary adversaries?
--------
Two things result from this fact.
1. Communism is already acknowledged by all European Powers to be itself a Power.
2. It is high time that Communists should openly, in the face of the whole world, publish their views, their aims, their tendencies, and meet this nursery tale of
--------
@BaksiLi
BaksiLi / calfunc.py
Last active May 27, 2020 22:21
Calculating with functions by Functional Programming with Python @ Codewars
# Calculating with Functions
# https://www.codewars.com/kata/525f3eda17c7cd9f9e000b39
import operator as op
op_curried = lambda f: lambda y: lambda x: f(x, y)
plus = op_curried(op.add)
minus = op_curried(op.sub)
times = op_curried(op.mul)
divided_by = op_curried(op.floordiv)
### Keybase proof
I hereby claim:
* I am baksili on github.
* I am baksili (https://keybase.io/baksili) on keybase.
* I have a public key ASBzhPwXC8Y5FhkW0IvqobXELg2eQEMdMxp2x8XqHmE5qAo
To claim this, I am signing this object:
@BaksiLi
BaksiLi / analyse.py
Created May 18, 2020 00:22
Visualize WakaTime statistics data in a decent way
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
from time import localtime
import plotly.graph_objects as go
def read_from(fpath):