Skip to content

Instantly share code, notes, and snippets.

View brodzik's full-sized avatar
💣

Adrian Brodzik brodzik

💣
  • Warsaw University of Technology
  • Poland
View GitHub Profile
@brodzik
brodzik / flip.js
Created October 3, 2017 18:10
Rotate Twitch player
$('.player').css('transform', 'rotate(180deg)');
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
" Vim color file - cobalt
" Generated by http://bytefluent.com/vivify 2017-05-09
set background=dark
if version > 580
hi clear
if exists("syntax_on")
syntax reset
endif
endif
import os
import random
import cv2
import numpy as np
import pandas as pd
import torch
import torch.cuda
import torch.nn as nn
from albumentations import *
import cv2
import os
import glob
import argparse
from tqdm import tqdm
import pandas as pd
def click_and_crop(event, x, y, flags, param, points):
if event == cv2.EVENT_LBUTTONUP:
@brodzik
brodzik / move.sh
Created May 13, 2020 23:45
Move files from sub-directories to current directory.
find . -mindepth 2 -type f -exec mv --backup=numbered {} . \;
@brodzik
brodzik / seed_everything.py
Last active October 8, 2021 19:26
seed_everything i.e. initialize pseudo-random number generators
import os
import random
import numpy as np
import torch
def seed_everything(seed):
random.seed(seed)
os.environ["PYTHONHASHSEED"] = str(seed)
np.random.seed(seed)
@brodzik
brodzik / count_parameters.py
Created August 9, 2020 12:46
Get the number of trainable parameters in PyTorch
def count_parameters(model):
return sum(p.numel() for p in model.parameters() if p.requires_grad)
@brodzik
brodzik / get_lr.py
Created August 27, 2020 19:25
Get the current learning rate in PyTorch
def get_lr(optimizer):
for p in optimizer.param_groups:
return p["lr"]