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
# 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 |
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
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 |
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://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] |
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
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: |
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 asyncio | |
import time | |
sema = asyncio.Semaphore(value=5) | |
async def worker(): | |
async with sema: | |
print("Start") | |
await asyncio.sleep(3) |
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 ctypes | |
import time | |
from typing import Any | |
TABLE = { | |
'to_list': lambda txt: txt.decode('utf-8').splitlines(), | |
} | |
__doc__ = """ |
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
from typing import List | |
import tinycss2 | |
import tinycss2.ast | |
def get_desired(filename): | |
""" | |
Read desired css line by line from a 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
#!/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 |
on ntfs use ntfs-3g
- to get uuid blkid UUID=$UUID $DIR ntfs-3g defaults 0 0
OlderNewer