Skip to content

Instantly share code, notes, and snippets.

View pawel-grabowski's full-sized avatar

PawelG pawel-grabowski

View GitHub Profile
# One-way synchronization of dotfiles
$wslUser = "username"
# Define the repositories and their corresponding file copy operations
$repositories = @(
@{
# VSC
Path = "C:\path\to\repository1"
FilesToCopy = @(
@{ Source = "keybindings.json"; Destination = "C:\Users\$env:USERNAME\AppData\Roaming\Code\User\keybindings.json" },
@pawel-grabowski
pawel-grabowski / .bashrc
Last active October 17, 2024 21:53
Config for Git Bash + fff
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
import json
import pandas as pd
def save_dataframes_to_json(dataframes_dict, file_name):
data_dict = {}
for key, value in dataframes_dict.items():
data_dict[key] = value.to_dict(orient='records')
with open(file_name, 'w') as f:
json.dump(data_dict, f, default=str)
@pawel-grabowski
pawel-grabowski / parse_pdf.R
Created April 15, 2021 13:28
Parse PDF files line by line
library(pdftools)
# you can use an url or a path
pdf_url <- "https://cran.r-project.org/web/packages/pdftools/pdftools.pdf"
# `pdf_text` converts it to a list
list_output <- pdftools::pdf_text(pdf_url)
print(list_output)
@pawel-grabowski
pawel-grabowski / ListFiles.bas
Last active March 16, 2023 21:43
Create list of files in the chosen directory #VBA
Sub ListFilesFolder()
'na podstawie przykładu od MVP OShon z VBATools.pl
Dim ob As Object, pliki As Object, plik As Object
Dim folder As Object, sciezka$, r&: r = 2 ' $ i & to skrócone deklaracje typu zmiennych!
sciezka = SelectFolder
Cells(1, 1) = "nazwa pliku"
Cells(1, 2) = "plik ze ścieżka"
Cells(1, 3) = "rozmiar"
Cells(1, 4) = "rodzaj"
Cells(1, 5) = "utworzono"
@pawel-grabowski
pawel-grabowski / cleaner.py
Last active March 15, 2020 10:52
Porządkowanie folderu Downloads wg rozszerzeń plików #Python
import os
import time
# stworzenie listy plików
folder_path ='C:/Users/Paweł/Downloads/'
files = os.listdir(folder_path)
# odczyt zawartość kolejnych plików w pętli i ich przeniesienie
for file in files:
@pawel-grabowski
pawel-grabowski / last_day_of_month.R
Created January 21, 2020 20:04
Funkcje do operacji na datach #R #Calendar
month_end_date <- function(my_date) {
next_month_date <- c()
next_month_date[1] <- substr(my_date,1,4)
next_month_date[2] <- as.character(sprintf("%02d",as.integer(substr(my_date,6,7))+1))
next_month_date[3] <- "01" #substr(my_date,9,10)
if (as.integer(next_month_date[2])>=12){
next_month_date[1] <- as.character(as.integer(next_month_date[1])+1)
next_month_date[2] <- "01"
}
@pawel-grabowski
pawel-grabowski / background.js
Created January 14, 2020 22:35
Skróty do skryptozakładek w Chrome #bookmarklets #js
// # Dodać do Chrome jako dodatek w "Trybie developera"
// ===UserScript===
// @name Bookmark Launcher
// @description Launches bookmarks with keyboard shortcuts
// ===/UserScript===
// 'javascript:var tabindex = 0;function next(){ var tab = document.getElementsByClassName("fl"); tab[tabindex].focus(); if(tabindex == tab.length -1){ tabindex = 0; } else{ tabindex ++; }}';
@pawel-grabowski
pawel-grabowski / kopiujAPI.bas
Last active March 15, 2020 11:31
Kopiowanie wartość z oddzieleniem ich przecinkami - #VBA
Option Explicit
'deklaracja funkcji Windows API z https://docs.microsoft.com/en-us/office/vba/access/Concepts/Windows-API/send-information-to-the-clipboard
' dla wersji 32-bit
'Private Declare Function OpenClipboard Lib "user32.dll" (ByVal hWnd As Long) As Long
'Private Declare Function EmptyClipboard Lib "user32.dll" () As Long
'Private Declare Function CloseClipboard Lib "user32.dll" () As Long
''--
'Private Declare Function IsClipboardFormatAvailable Lib "user32.dll" (ByVal wFormat As Long) As Long
'Private Declare Function GetClipboardData Lib "user32.dll" (ByVal wFormat As Long) As Long
''--