Skip to content

Instantly share code, notes, and snippets.

Avatar

zanculmarktum

View GitHub Profile
@zanculmarktum
zanculmarktum / same.awk
Created Jun 18, 2020
Check if all fields are the same
View same.awk
# 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 Jul 9, 2018
Get the last post number from 4chan
View get.py
#!/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 Jun 16, 2021
Get download url from mega.nz
View megafetch.sh
#!/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 Apr 7, 2018
Convert chromium cookies to netscape format
View convert_cookies.sh
#!/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"
View urlencode.sh
#!/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 Mar 15, 2018
Adds a telkampret connection to NetworkManager.
View telkampret.sh
#!/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 Aug 9, 2018
Get download url from various filehostings via curl
View urlfetch.sh
#!/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.