Skip to content

Instantly share code, notes, and snippets.

View bukowa's full-sized avatar

Mateusz Kurowski bukowa

View GitHub Profile
@bukowa
bukowa / mapa.py
Created June 1, 2018 20:40
mapa polski
# credits https://blog.furas.pl/rysowanie-danych-na-mapie-w-Pythonie.html
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# rozwiazanie na problem ze znalezieniem modulu `basemap` na moim komputerze
import mpl_toolkits
mpl_toolkits.__path__.insert(0, '/usr/lib/pymodules/python2.7/mpl_toolkits')
# na podstawie: BaseMap example by geophysique.be - tutorial 01
# adres: http://www.geophysique.be/tutorials
@bukowa
bukowa / poechecker.py
Last active March 9, 2019 14:52
path of exile check poe.trade
from dataclasses import dataclass
from bs4 import BeautifulSoup as soup
import requests
from collections import Counter
import time
# python 3.7
# installation:
# pip install bs4 lxml requests
@bukowa
bukowa / .htaccess
Created July 12, 2019 17:24
www/http -> https htaccess rewrite
# https://simonecarletti.com/blog/2016/08/redirect-domain-http-https-www-apache/
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
@bukowa
bukowa / django_filter_views.py
Last active February 14, 2023 02:59
django filter mixin
class FilterMixin:
filter_model = None
filter_params = {}
def get_filter_params(self):
filter_params = {}
for k, v in self.filter_params.items():
param = self.request.GET.get(k)
if param:
@bukowa
bukowa / looping.py
Created August 7, 2019 22:53
async loop
import asyncio
import time
sema = asyncio.Semaphore(value=5)
async def worker():
async with sema:
print("Start")
await asyncio.sleep(3)
@bukowa
bukowa / clipboard_script.py
Last active November 14, 2019 06:27
clipboard > windows > python >: read_clipboard_data()
import ctypes
import time
from typing import Any
TABLE = {
'to_list': lambda txt: txt.decode('utf-8').splitlines(),
}
__doc__ = """
@bukowa
bukowa / parse_css.py
Last active December 19, 2019 00:13
css get classes for values
from typing import List
import tinycss2
import tinycss2.ast
def get_desired(filename):
"""
Read desired css line by line from a file.
"""
@bukowa
bukowa / README.md
Created October 26, 2022 00:20
kubernetes k3s virtualbox ubuntu minimal server
@bukowa
bukowa / install.sh
Last active November 2, 2022 11:27
k3s alpine cloned vm prepare
#!/bin/sh
set -eu
IP=${1}
HOST=${2}
echo "${HOST}" > /etc/hostname
printf "127.0.0.1\tlocalhost\n::1\tlocalhost\n" > /etc/hosts
sed -i "s/address.*/address $IP/" /etc/network/interfaces
@bukowa
bukowa / alpine.MD
Created October 31, 2022 11:46
alpine linux

on ntfs use ntfs-3g - to get uuid blkid UUID=$UUID $DIR ntfs-3g defaults 0 0