Skip to content

Instantly share code, notes, and snippets.

"""
This script does something and returns something
"""
__author__ = ""
__copyright__ = ""
__license__ = ""
__version__ = "0.1"
__maintainer__ = ""
__email__ = "@"
@sikli
sikli / Back-up postgres without password
Last active October 4, 2020 16:15
Backup a postgres db without password by creating a .pgpass file
sudo touch ~/.pgpass
echo 'host:5432:somedb:someuser:somepass' >> ~/.pgpass
sudo chmod 600 ~/.pgpass
sudo chown login_username:login_username .pgpass
export PGPASSFILE='/home/user/.pgpass'
pg_dump -U postgres -h localhost db_name -F c | gzip > /mnt/backup/bkp_name.gz
@sikli
sikli / quantile_speed.R
Last active June 12, 2024 21:02
speeded up R quantile function
#speeded up R quantile function
#code is based on the original quantile function {stats}: https://svn.r-project.org/R/trunk/src/library/stats/R/quantile.R
#This modifed function only supports the 'type 7' quantile algorithm
#The following features were removed (to increase perfomance) :
# - output quantile names
# - error handling such as check if x are factors, or if probs lie outside the [0-1] range
#this makes the speeded up function much more prone to errors, but at the same time faster:
# x <- runif(10000)