Skip to content

Instantly share code, notes, and snippets.

View purarue's full-sized avatar
📀
:)

purarue

📀
:)
View GitHub Profile
journal-new() {
local target
cd "${XDG_DOCUMENTS_DIR}/Notes/journal" || return
target="$(date "+%Y-%m-%d").md"
if [[ ! -f "$target" ]]; then
{
date
printf '\n\n'
} >"$target"
fi
@purarue
purarue / upgrading-virtualenv.sh
Last active November 16, 2024 05:33
Copying dependencies to a new virtual environment
# activate it
source bin/env/bin/activate
# make sure python is pointing at the correct place
# (it should be inside the .venv folder which youre activated in)
(.venv) [dev@fish-webserver ~/code/dbsentinel/.venv ] $ which python3
/home/dev/code/dbsentinel/.venv/bin/python3
(.venv) [dev@fish-webserver ~/code/dbsentinel/.venv ] $ which pip3
/home/dev/code/dbsentinel/.venv/bin/pip3
(.venv) [dev@fish-webserver ~/code/dbsentinel/.venv ] $ which pip
/home/dev/code/dbsentinel/.venv/bin/pip
https://archive.org/details/ucberkeley_webcast__qGeRWplPgc
https://archive.org/details/ucberkeley_webcast_nzMPF59Ackg
https://archive.org/details/ucberkeley_webcast_pSuEz5ZCVAg
https://archive.org/details/ucberkeley_webcast_kbqJ3UGPgOc
https://archive.org/details/ucberkeley_webcast_3FjDrWv00Hc
https://archive.org/details/ucberkeley_webcast_rz_XpDhDtFI
https://archive.org/details/ucberkeley_webcast_8HDIqZ2ZqKI
https://archive.org/details/ucberkeley_webcast_jq1v8YUftxE
https://archive.org/details/ucberkeley_webcast_S9mGKy3Dzqw
https://archive.org/details/ucberkeley_webcast_l28HAzKy0N8
[ERROR 2023-09-21 19:23:42,017 my.time.tz.via_location __init__.py:283 ] [my.time.tz.via_location:_iter_tzs] error while setting up cache, falling back to non-cached version
[ERROR 2023-09-21 19:23:42,017 my.time.tz.via_location __init__.py:284 ] [my.time.tz.via_location:_iter_tzs] (sqlite3.ProgrammingError) Cannot operate on a closed database.
(Background on this error at: https://sqlalche.me/e/14/f405)
Traceback (most recent call last):
File "/home/username/.local/lib/python3.11/site-packages/cachew/__init__.py", line 815, in cachew_wrapper
yield from cached_items()
GeneratorExit
During handling of the above exception, another exception occurred:
[ /data/data/com.termux/files/usr/tmp/3mZRdb5YyY/dune | main ] $ ./dune.exe build dune.install --verbose
Warning: Unable to read directory /data/data. Will not look for root in
parent directories.
Reason: /data/data: Permission denied
To remove this warning, set your root explicitly using --root.
Shared cache: disabled
Workspace root: /data/data/com.termux/files/usr/tmp/3mZRdb5YyY/dune
Auto-detected concurrency: 8
Dune context:
{ name = "default"
$ opam install dune --verbose
The following actions will be performed:
∗ install dune 3.10.0
<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[dune.3.10.0] found in cache
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+ /data/data/com.termux/files/home/.opam/5.0.0/bin/ocaml "boot/bootstrap.ml" "-j" "1" (CWD=/data/data/com.termux/files/home/.opam/5.0.0/.opam-switch/build/dune.3.10.0)
- ocamlc -output-complete-exe -w -24 -g -o .duneboot.exe -I boot -I +unix unix.cma boot/libs.ml boot/duneboot.ml
@purarue
purarue / yt_archive_layout.py
Created August 23, 2023 05:30
possible schema for youtube proxy/s3 uploader
class ChannelBase(SQLModel):
url: str # url to download with
command: str
proxy: Optional[str] = Field(default=None) # yt-dl proxy
yt_dl_args: Optional[str] = Field(default=None) # additional arguments to yt-dlp
gallery_dl_args: Optional[str] = Field(default=None)
name: Optional[str] = Field(default=None)
rerequest_time: Optional[int] = Field(default=None)
python3 -m bleanser_pura.modules.grouvee prune --move /home/username/.cache/removed --yes --sort-by size /home/username/data/grouvee
python3 -m bleanser_pura.modules.zsh prune --move /home/username/.cache/removed --yes --sort-by size /home/username/data/zsh_history
python3 -m bleanser_pura.modules.bash prune --move /home/username/.cache/removed --yes --sort-by size /home/username/data/bash
python3 -m bleanser_pura.modules.bash prune --move /home/username/.cache/removed --yes --sort-by size /home/username/data/bash_history
python3 -m bleanser_pura.modules.ipython prune --move /home/username/.cache/removed --yes --sort-by size /home/username/data/ipython_default
python3 -m bleanser_pura.modules.ipython prune --move /home/username/.cache/removed --yes --sort-by size /home/username/data/ipython_calculator/
python3 -m bleanser_pura.modules.cstimer prune --move /home/username/.cache/removed --yes --sort-by size /home/username/data/cubing/cstimer
python3 -m bleanser_pura.modules.twistytimer prune --move /home/userna
from typing import Iterator, TypeVar
from decimal import Decimal
it = int(input("Enter number of iterations: "))
def calculate_pi(till: int, factory: TypeVar) -> Iterator[int]:
approx = factory(0)
denom = factory(1)
for i in range(till):
#!/bin/bash
# pass 'manga' as the first arg to the script to scrape manga instead
# requires https://github.com/ericchiang/pup to be installed
sort_by_id() {
sort -n -t= -k 2
}
scrape_type="${1:-anime}"
case "${scrape_type}" in