Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Karol Zlot karolzlot

🏠
Working from home
View GitHub Profile
@karolzlot
karolzlot / logitech_k740_fn_remap.ahk
Last active Apr 11, 2022
How to remap Logitech k740 function keys with autohotkey
View logitech_k740_fn_remap.ahk
; 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 / discord_hide_to_try.ahk
Last active Mar 13, 2022
This script is written in AHK v2
View discord_hide_to_try.ahk
#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 / tqdm_cpu_ram.py
Last active Jun 25, 2022
Monitoring real time cpu and ram usage with tqdm. If you like it please upvote this answer: https://stackoverflow.com/a/69511430/8896457
View tqdm_cpu_ram.py
from tqdm import tqdm
from time import sleep
import psutil
with tqdm(total=100, desc='cpu%', position=1) as cpubar, tqdm(total=100, desc='ram%', position=0) as rambar:
while True:
rambar.n=psutil.virtual_memory().percent
cpubar.n=psutil.cpu_percent()
rambar.refresh()
cpubar.refresh()
@karolzlot
karolzlot / tqdm2.py
Created Oct 9, 2021
tqdm multiline example 2
View tqdm2.py
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 Oct 9, 2021
tdqm multiline example 1
View tqdm1.py
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 / __main__.py
Created Jul 7, 2021
Pulumi + Python + Google Cloud Run -> version 1, with public access
View __main__.py
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 / __main__.py
Last active Jul 6, 2021
Pulumi + Python + Google Cloud Run -> version 1, without public access
View __main__.py
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 Jun 28, 2021
Example script to list all file revisions in google drive (only in root folder)
View gdrive_list_revisions.py
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 / stack question.md
Last active Jul 14, 2022
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
View stack question.md

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 / bwa, samtools, bcftools on WSL.txt
Last active Feb 23, 2021
Install bwa, samtools & bcftools on Windows WSL (Ubuntu)
View bwa, samtools, bcftools on WSL.txt
# 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