Skip to content

Instantly share code, notes, and snippets.

View piojanu's full-sized avatar

Piotr Januszewski piojanu

View GitHub Profile
@piojanu
piojanu / bigquery_df.py
Last active January 2, 2024 15:35
A basic wrapper around the BigQuery Python client for performing group-by and aggregation operations similar to those in Pandas.
from google.cloud import bigquery
from pandas import DataFrame
class BigQueryDataFrame:
"""
This class is a wrapper around the BigQuery Python client for performing groupby and aggregation operations
similar to those in pandas, but on BigQuery data.
Basic usage:
```python
@piojanu
piojanu / sparse_pytorch_tensor.py
Last active March 1, 2023 10:55
Wrapper around a PyTorch sparse tensor that allows quick access to the values at the first dimension.
import functools
from typing import Any, Sequence, Tuple, Union
import torch as th
HANDLED_FUNCTIONS = {}
# TODO: Properly type annotate.
def implements(torch_function: Any) -> Any:
{
"workbench.colorTheme": "doom-one",
"terminal.integrated.inheritEnv": false,
"editor.fontFamily": "'Fira Code', Menlo, Monaco, 'Courier New', monospace",
"editor.fontWeight": 500,
"debug.console.fontSize": 14,
"terminal.integrated.fontSize": 14,
"scm.inputFontSize": 14,
"editor.minimap.enabled": false,
"atomKeymap.promptV3Features": true,
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
############################################################
# +------------------------------------------------------+ #
# | Notes | #
# +------------------------------------------------------+ #
############################################################
# This is the config file for EssentialsX.
# This config was generated for version 2.18.1.0.
# If you want to use special characters in this document, such as accented letters, you MUST save the file as UTF-8, not ANSI.
@piojanu
piojanu / gist:1bd869340d180975dd36d2c24c3285de
Created November 5, 2020 00:49
Cannot run program "rdiff-backup world backups/world": error=2, No such file or directory
[01:31:35] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', name='PROD'
[01:31:36] [main/INFO]: Reloading ResourceManager: Default, bukkit
[01:31:38] [Worker-Main-2/INFO]: Loaded 7 recipes
[01:31:43] [Server thread/INFO]: Starting minecraft server version 1.16.3
[01:31:43] [Server thread/INFO]: Loading properties
[01:31:44] [Server thread/INFO]: This server is running CraftBukkit version git-Spigot-2740d5a-890130b (MC: 1.16.3) (Implementing API version 1.16.3-R0.1-SNAPSHOT)
[01:31:44] [Server thread/INFO]: Server Ping Player Sample Count: 12
[01:31:44] [Server thread/INFO]: Using 4 threads for Netty based IO
[01:31:44] [Server thread/INFO]: Debug logging is disabled
[01:31:44] [Server thread/INFO]: Default game type: SURVIVAL
[alias]
unstage = reset HEAD --
info = show --name-only
detail = show --decorate=full
contains = log --source --all -G
co = checkout
ci = commit
st = status
br = branch
hist = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
@piojanu
piojanu / .bash_aliases
Last active November 8, 2019 12:22
Bash aliases
alias p='python'
alias p3='python3'
alias ga='git add'
alias gci='git commit -m'
alias gcia='git commit -am'
alias gco='git checkout'
alias gh="git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'"
alias gs='git status'
@piojanu
piojanu / mnist_vae.py
Last active April 7, 2019 09:34
TensorFlow Probability MNIST VAE implementation using tf_utils (https://github.com/piojanu/tf_utils/blob/master/tf_utils/utils.py)
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from tf_utils import AttrDict, lazy_property_with_scope
tfd = tfp.distributions
tfl = tf.layers
@piojanu
piojanu / pre-commit
Last active March 27, 2019 09:34 — forked from Matioz/pre-commit
Applies autopep8 on all staged files and verify them with pycodestyle
#!/usr/bin/env python
from __future__ import with_statement, print_function
import os
import re
import shutil
import subprocess
import sys
import tempfile