Skip to content

Instantly share code, notes, and snippets.

View karolzlot's full-sized avatar
🏠
Working from home

Karol Zlot karolzlot

🏠
Working from home
View GitHub Profile
@karolzlot
karolzlot / bwa, samtools, bcftools on WSL.txt
Last active February 23, 2021 07:35
Install bwa, samtools & bcftools on Windows WSL (Ubuntu)
# tested on WSL 2, Ubuntu 18.04 LTS
# needed for bwa & samtools
sudo apt-get install build-essential make libz-dev -y
# needed for samtools
sudo apt-get install cwltool libc-ares2 libhttp-parser2.7.1 libjs-bootstrap nodejs nodejs-doc python python-asn1crypto python-avro python-cachecontrol python-certifi python-cffi-backend python-chardet python-cryptography python-enum34 python-html5lib python-idna python-ipaddress python-isodate python-lockfile python-mistune python-openssl python-pkg-resources python-pyparsing python-rdflib python-rdflib-jsonld python-requests python-ruamel.yaml python-schema-salad python-shellescape python-six python-sparqlwrapper python-typing python-urllib3 python-webencodings -y
sudo apt-get install libncurses5-dev -y
# sudo apt-get remove zlib1g-dev -y
sudo apt-get install zlib1g-dev -y
@karolzlot
karolzlot / __main__.py
Last active July 6, 2021 23:41
Pulumi + Python + Google Cloud Run -> version 1, without public access
import pulumi
import pulumi_gcp as gcp
region= "us-central1"
# Cloud Run Service is not enabled by default, let's enable it
enableCloudRun = gcp.projects.Service("EnableCloudRun",
service= "run.googleapis.com",
@karolzlot
karolzlot / gdrive_list_revisions.py
Created June 28, 2021 05:12
Example script to list all file revisions in google drive (only in root folder)
from __future__ import print_function
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
# If modifying these scopes, delete the file token.json.
SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly']
@karolzlot
karolzlot / __main__.py
Created July 7, 2021 00:53
Pulumi + Python + Google Cloud Run -> version 1, with public access
import pulumi
import pulumi_gcp as gcp
region= "us-central1"
# Cloud Run Service is not enabled by default, let's enable it
enableCloudRun = gcp.projects.Service("EnableCloudRun",
service= "run.googleapis.com",
)
@karolzlot
karolzlot / tqdm2.py
Created October 9, 2021 01:03
tqdm multiline example 2
from tqdm import tqdm
from time import sleep
with tqdm(total=4, desc='1st loop', position=2) as pbar1:
with tqdm(total=5, desc='2nd loop', position=1) as pbar2:
with tqdm(total=50, desc='3rd loop', position=0) as pbar3:
for i in range(4):
pbar2.reset()
for j in range(5):
@karolzlot
karolzlot / tqdm1.py
Last active October 9, 2021 01:03
tdqm multiline example 1
from tqdm import tqdm
from time import sleep
with tqdm(total=4, desc='1st loop', position=2) as pbar1:
with tqdm(total=5, desc='2nd loop', position=1) as pbar2:
with tqdm(total=50, desc='3rd loop', position=0) as pbar3:
for i in range(4):
pbar2.reset()
for j in range(5):
@karolzlot
karolzlot / discord_hide_to_try.ahk
Last active March 13, 2022 03:13
This script is written in AHK v2
#SingleInstance Force
#Warn ; Enable warnings to assist with detecting common errors.
SendMode "Input" ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir A_ScriptDir ; Ensures a consistent starting directory.
; This script hides Discord to tray.
if (not ProcessExist("Discord.exe"))
{
Run "C:\Users\user\AppData\Local\Discord\Update.exe --processStart Discord.exe --process-start-args --start-minimized"
@karolzlot
karolzlot / logitech_k740_fn_remap.ahk
Last active April 11, 2022 05:43
How to remap Logitech k740 function keys with autohotkey
; This file is autohotkey v2 script.
#SingleInstance Force
#Warn ; Enable warnings to assist with detecting common errors.
SendMode "Input" ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir A_ScriptDir ; Ensures a consistent starting directory.
InstallKeybdHook ; how it works: https://lexikos.github.io/v2/docs/commands/InstallKeybdHook.htm
@karolzlot
karolzlot / stack question.md
Last active July 14, 2022 12:57
Get differences between two lists of dictonaries (result as two differences lists) in Python - this is a draft for a question which finally landed here: https://stackoverflow.com/questions/68091970/get-differences-between-two-lists-of-dictionaries-result-as-two-differences-lis

I have two lists of dictonaries. They contain gmail labels and filters. I need to get differences between them in form of two differences lists. I want order of the elements to be preserved.

Example:

a=[
	{'name': 'label_a'},
	{'color': {'background': '#42d692', 'text': '#094228'}, 'name': 'label_b'},
@karolzlot
karolzlot / normalization_comparison.py
Created December 1, 2022 01:10
Python normalization comparison
import unicodedata
from unidecode import unidecode
def normalize(text:str):
text = unicodedata.normalize('NFD', text)\
.encode('ascii', 'ignore')\
.decode("utf-8")
return text
text ='zażółć gęślą jaźń, kožušček 北亰 François aaßaa aßb'