Skip to content

Instantly share code, notes, and snippets.

View zanculmarktum's full-sized avatar

zanculmarktum

View GitHub Profile
@zanculmarktum
zanculmarktum / dynamic-webm.sh
Created March 18, 2023 13:21
Dynamic WebM resolution
#!/usr/bin/env bash
tmpfile=$(mktemp)
clean_up() {
rm -f "$tmpfile"
}
trap "clean_up" EXIT
trap "clean_up; exit 1" INT TERM
@zanculmarktum
zanculmarktum / same.awk
Created June 18, 2020 09:43
Check if all fields are the same
# Check if all fields are the same.
NF > 1 {
i=2 # nth field to starts with
for (i; i<=NF; i++) {
for (j=i+1; j<=NF; j++) {
if ($i != $j) {
print $0
break
@zanculmarktum
zanculmarktum / get.py
Created July 9, 2018 09:47
Get the last post number from 4chan
#!/usr/bin/python
from __future__ import print_function
import sys
if sys.version_info[0] == 3:
import urllib.request as urllib
else:
import urllib2 as urllib
import json
def usage():
@zanculmarktum
zanculmarktum / megafetch.sh
Last active October 20, 2024 08:05
Get download url from mega.nz
#!/bin/bash
# Copyright 2018, 2019, 2020 Azure Zanculmarktum
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
@zanculmarktum
zanculmarktum / convert_cookies.sh
Created April 7, 2018 09:06
Convert chromium cookies to netscape format
#!/bin/sh
cookies_path=~/.local/share/qutebrowser/webengine/Cookies
#sqlite3 $cookies_path 'pragma table_info(cookies)'
#echo
sqlite3 -separator "$(printf '\t')" $cookies_path \
'select host_key,httponly,path,secure,expires_utc,name,value from cookies where host_key like "%'"$1"'%"' | \
awk '
BEGIN {
FS="\t"
OFS="\t"
#!/bin/sh
urlencode() {
c="${1%${1#?}}"
if [ -n "$c" ]; then
case "$c" in
[a-zA-Z0-9.~_-]) printf "$c" ;;
*) printf '%%%.2X' "'$c" ;;
esac
urlencode "${1#?}"
@zanculmarktum
zanculmarktum / telkampret.sh
Created March 15, 2018 01:50
Adds a telkampret connection to NetworkManager.
#!/bin/sh
# Adds a telkampret connection to NetworkManager.
if [ "$(id -u)" != "0" ]; then
echo "${0##*/}: super user access required" >&2
exit 1
fi
if ! which nmcli >/dev/null 2>&1; then
@zanculmarktum
zanculmarktum / urlfetch.sh
Last active August 9, 2018 19:37
Get download url from various filehostings via curl
#!/bin/sh
# Copyright 2018 Azure Zanculmarktum
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.