Skip to content

Instantly share code, notes, and snippets.

View data4sci's full-sized avatar

Robert Samarek data4sci

  • VSB - Technical University of Ostrava
  • Ostrava, Czech Republic
View GitHub Profile
@data4sci
data4sci / .sh
Created August 22, 2020 19:34
rsync local folders
rsync -rtvu --delete source_folder/ destination_folder/
@data4sci
data4sci / .py
Created January 27, 2021 21:13
progress bar #python tqdm
from tqdm import tqdm
from time import sleep
for i in tqdm(range(1000)):
sleep(.01)
@data4sci
data4sci / .vimrc
Created February 27, 2021 12:07 — forked from miguelgrinberg/.vimrc
My .vimrc configuration for working in Python with vim
" plugins
let need_to_install_plugins = 0
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
let need_to_install_plugins = 1
endif
call plug#begin()
Plug 'tpope/vim-sensible'
@data4sci
data4sci / .py
Created May 25, 2021 07:53
Maximální délka řetězce ve sloupci --> VARCHAR(délka) #python #pandas #sql
In [41]: df.c_str.str.len().max()
Out[41]: 13
In [42]: df.to_sql('test', engine, index_label='id', if_exists='replace',
....: dtype={'c_str': types.VARCHAR(df.c_str.str.len().max())})
@data4sci
data4sci / .sh
Created May 25, 2021 08:05
ssh key generation
# terminálem na vzdáleném serveru
ssh-keygen -o -t rsa -b 4096
---
# zkopírovat public key v do souboru na lokále
# /home/USER !!! pod kterým byl klíč generován
ssh root@dwhetl "cat /home/etl/.ssh/id_rsa.pub" > etl_dwhetl_public_key.pub
@data4sci
data4sci / .sh
Created May 25, 2021 08:13
create bootable USB disk from .iso file
# vypiš připojené disky
sudo fdisk -l
# odpoj disk
sudo umount /dev/sd<?><?>
# nahrej ISO na disk
sudo dd bs=4M if=input.iso of=/dev/sd<?> conv=fdatasync
@data4sci
data4sci / .py
Created May 25, 2021 08:17
#python #pandas output limits
pd.set_option('display.max_columns', None)
pd.set_option('display.max_colwidth', -1)
#pd.set_option('display.max_columns', None)
#pd.set_option('display.expand_frame_repr', False)
#pd.set_option('max_colwidth', -1)
#pd.set_option('display.width', 80)
#pd.reset_option("all")
@data4sci
data4sci / .py
Created May 25, 2021 08:18
max délka řetězce ve sloupci #pandas #python
int(df[df_col_name].str.encode(encoding='utf-8').str.len().max())
# nebo
df.col1.str.len().max()
# nebo
df.col1.map(lambda x: len(x)).max()
# nebo
df.col1.map(len).max()
for col in df.columns:
@data4sci
data4sci / .sh
Created May 25, 2021 08:46
about computer/OS
inxi -S
# nebo
neofetch
@data4sci
data4sci / .sh
Created May 25, 2021 08:49
suspend computer after 30min
echo 'systemctl suspend' | at now + 30 minutes