Skip to content

Instantly share code, notes, and snippets.

View asdfMaciej's full-sized avatar
👀

Maciej Kaszkowiak asdfMaciej

👀
View GitHub Profile
@asdfMaciej
asdfMaciej / polylang-directory-domain-snippet.php
Last active October 29, 2023 11:28
Polylang - rewrite permalinks to directories and domains
<?php
// Created by Maciej Kaszkowiak (maciej@kaszkowiak.org)
// Implemented according to https://wordpress.org/support/topic/multiple-languages-in-the-same-domain/
// Modify PLL_Links_Sterowniki.hosts and PLL_Links_Sterowniki.protocols in order to set domains
// The remaining languages will redirect to directories, such as /en/ or /it/
/**
* Links model for use when the language code is added in url as a directory
* for example mysite.com/en/something
@asdfMaciej
asdfMaciej / k-podobne.py
Created September 8, 2020 07:07
MIN-R1_1P-202 - zad 1.2
def czy_k_podobne(n, A, B, k):
if cmp(A, B, n) and k==0:
return True
# indeksy sa zmniejszone o 1 w porownaniu do zadania
# ze wzgledu na 0-indexing (w zad. jest 1-indexing)
if (cmp(slice(A, 0, k-1), slice(B, n-k, n-1), k)
and cmp(slice(A, k, n-1), slice(B, 0, n-k-1), n-k)):
return True
@asdfMaciej
asdfMaciej / rsa.py
Created May 21, 2020 15:24
RSA number encryption/decryption in Python.
# wymagania: pprint
import random
from pprint import pprint
# algorytm euklidesa
def gcd(a, b):
if (b == 0):
return a
return gcd(b, a % b)
@asdfMaciej
asdfMaciej / huffman.py
Last active May 8, 2020 12:31
Basic implementation of the Huffman algorithm in Python.
"""
Basic implementation of the Huffman algorithm for school.
Created according to https://riptutorial.com/algorithm/example/23995/huffman-coding
Author: Maciej Kaszkowiak (@asdfMaciej), 2020-05-08
Licensed under GNU GPL
"""
from heapq import heappop, heappush
from collections import Counter
@asdfMaciej
asdfMaciej / instagram_followers.py
Created May 28, 2019 13:06
spot and get rid of inactive Instagram followers & see who stopped following
"""
Usage:
scrape the XHR requests manually to files [tedious, but faster for me than implementing a scraper]
l01, l02.. etc should contain like requests
f1 f2 f3.. etc should contain followers
get a better like to follower ratio than ever lmao
"""
import json
@asdfMaciej
asdfMaciej / lesna.py
Created December 11, 2017 15:53
For school, by asdfMaciej
#!/usr/bin/python3
# Python 3.x, licencja GNU GPL - Maciej Kaszkowiak (asdfMaciej), 2017
import urllib
import urllib.request
import sqlite3
import argparse
from time import gmtime, strftime