This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://old.reddit.com/r/pushshift/comments/ajmcc0/information_and_code_examples_on_how_to_use_the/ | |
with open("filename.zst", 'rb') as fh: | |
dctx = zstd.ZstdDecompressor(max_window_size=2147483648) | |
with dctx.stream_reader(fh) as reader: | |
previous_line = "" | |
while True: | |
chunk = reader.read(2**24) # 16mb chunks | |
if not chunk: | |
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
subcommand_abbrevs = [] | |
def consequtive_combos(s): | |
combos=[list(itertools.combinations(s,x)) for x in range(1,len(s))] | |
combos=set([''.join(e) for e in sum(combos,[]) if e[0] == s[0] and ''.join(e) not in subcommand_abbrevs]) | |
subcommand_abbrevs.extend(combos) | |
return combos | |
q=consequtive_combos('merge-online-local') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def youtube_dl_id(file) -> str: | |
if len(file) < 15: | |
return "" | |
# rename old youtube_dl format to new one: cargo install renamer; fd -tf . -x renamer '\-([\w\-_]{11})\.= [$1].' {} | |
yt_id_regex = re.compile(r"-([\w\-_]{11})\..*$|\[([\w\-_]{11})\]\..*$", flags=re.M) | |
file = str(file).strip() | |
yt_ids = yt_id_regex.findall(file) | |
if not yt_ids: | |
return "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dict_filter_bool(kwargs) -> dict: | |
return {k: v for k, v in kwargs.items() if v} | |
def list_dict_filter_bool(media: List[dict]) -> List[dict]: | |
return [dict_filter_bool(d) for d in media if len(dict_filter_bool(d)) > 0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$(xrandr --listactivemonitors | grep 'HDMI-A-0')" ]; then | |
xrandr --addmode HDMI-A-0 1920x1080 | |
xrandr --output HDMI-A-0 --mode 1920x1080 --right-of eDP | |
xrandr --output eDP --fb 5760x1080 --panning 5760x1080 | |
else | |
xrandr --output HDMI-A-0 --off | |
xrandr --delmode HDMI-A-0 1920x1080 | |
xrandr --output eDP --fb 1920x1080 --panning 0x0 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function lt-stop | |
/bin/rm /tmp/catt_playing & | |
pkill -f "python.*xklb.*lt" & | |
pkill -f .local/bin/lb | |
pkill -f '.local/bin/lt' | |
pkill mpv & | |
catt pause | |
catt -d "Xylo and Orchestra" set_default | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function nextSongDelete | |
if test -f /tmp/catt_playing | |
set song (string unescape (cat /tmp/catt_playing)) | |
else | |
set song (echo '{ "command": ["get_property", "path"] }' | socat - /tmp/mpv_socket | jq -r .data) | |
end | |
# if not test -f /tmp/catt_playing | |
echo 'playlist-next force' | socat - /tmp/mpv_socket | |
# end | |
catt stop & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tabs-monthly | |
set day_of_month (date "+%d") | |
set day_of_year (date "+%j") | |
set temp_file (mktemp) | |
cat ~/mc/monthly.cron ~/mc/reddit.monthly.cron >$temp_file | |
set file_len (cat $temp_file | count) | |
while test $day_of_month -lt $file_len | |
echo $day_of_month | |
set url (sed "$day_of_month""q;d" $temp_file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
is_vertical_video (fd -tf --max-results=1 -eWEBM -eMKV -eMP4 -eMOV -eAVI . src/ -E '*keep/*' -E '*gifs/*' -E '.nomedia') # random_choice | |
set want_vertical $status | |
set -l chosen | |
while test (count $chosen) -lt 24 | |
for video in (fd -tf --max-results=500 -eWEBM -eMKV -eMP4 -eMOV -eAVI . src/ -E '*keep/*' -E '*gifs/*' -E '.nomedia' ) | |
is_vertical_video "$video" | |
set is_vertical $status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function __fish_print_pipestatus | |
set -l last_status | |
if set -q __fish_last_status | |
set last_status $__fish_last_status | |
else | |
set last_status $argv[-1] # default to $pipestatus[-1] | |
end | |
set -l left_brace "[" | |
set -l right_brace "]" | |
set -l separator "|" |