Skip to content

Instantly share code, notes, and snippets.

View ktaranov's full-sized avatar
🎯
Focusing

Konstantin Taranov ktaranov

🎯
Focusing
View GitHub Profile
@ktaranov
ktaranov / yandex_email_for_domain_settings.py
Created March 16, 2022 05:12 — forked from nskeip/yandex_email_for_domain_settings.py
Django SMTP settings for yandex_for_domain mail (pdd.yandex.ru)
EMAIL_HOST = 'smtp.yandex.ru'
EMAIL_HOST_USER = 'login@example.com'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
@ktaranov
ktaranov / change_password.md
Created July 23, 2021 12:04 — forked from raprasad/change_password.md
django user; change password from shell

update django password

general changes

To use in dev environments

  • after python manage.py shell
from django.contrib.auth.models import User
import glob
import os
import cv2
import concurrent.futures
def load_and_resize(image_filename):
### Read in the image data
img = cv2.imread(image_filename)
@ktaranov
ktaranov / us_states_hexgrid.geojson
Created April 9, 2021 06:10 — forked from hrbrmstr/us_states_hexgrid.geojson
hexbin faceted choropleths in R
library(rgdal)
library(rgeos)
library(ggplot2)
library(readr)
library(tidyr)
library(dplyr)
library(grid)
us <- readOGR("us_states_hexgrid.geojson", "OGRGeoJSON")
@ktaranov
ktaranov / gist:4c9e6e05872c68f92345135141024889
Created March 19, 2021 15:31 — forked from g3d/gist:2709563
Clean Install – OS X 10.11 El Capitan
@ktaranov
ktaranov / num_rows_csv.R
Created February 25, 2021 13:17 — forked from peterhurford/num_rows_csv.R
What's the fastest way to determine the number of rows of a CSV in R?
# What's the fastest way to determine the number of rows of a CSV in R?
# ...Reading the entire CSV to only get the dimensions is likely too slow. Is there a faster way?
# Benchmarks done on a EC2 r3.8xlarge
# Cowritten with Abel Castillo <github.com/abelcastilloavant>
m <- 1000000
d <- data.frame(id = seq(m), a = rnorm(m), b = runif(m))
dim(d)
# [1] 1000000 3
pryr::object_size(d)
@ktaranov
ktaranov / .gitconfig
Created January 27, 2021 10:50 — forked from Xitsa/.gitconfig
Интеграция git и fzf
[alias]
xdiff = "!f() { \
git diff "$@" $(git ls-files --modified --exclude-standard | fzf -m); \
}; f"
xadd = "!f() { \
git add "$@" $(git ls-files --modified --others --exclude-standard | fzf -m); \
}; f"
@ktaranov
ktaranov / Find_Top_Exec_Plans_to_Optimize.sql
Created September 21, 2020 19:21 — forked from EitanBlumin/Find_Top_Exec_Plans_to_Optimize.sql
T-SQL script to find cached execution plans with good potential for performance optimization (warnings, missing indexes, bad operators, etc.)
/*
=======================================================
Find Top Exec Plans to Optimize
=======================================================
Author: Eitan Blumin | eitanblumin.com , madeiradata.com
Date: 2020-08-12
Description:
Use this script to discover execution plans with a good
potential for performance optimization.
Finds execution plans with warnings and problematic operators.
@ktaranov
ktaranov / pandas_crossjoin_example.py
Created February 12, 2020 15:01 — forked from internaut/pandas_crossjoin_example.py
Shows how to do a cross join (i.e. cartesian product) between two pandas DataFrames using an example on calculating the distances between origin and destination cities. See https://mkonrad.net/2016/04/16/cross-join--cartesian-product-between-pandas-dataframes.html
"""
Shows how to do a cross join (i.e. cartesian product) between two pandas DataFrames using an example on
calculating the distances between origin and destination cities.
Tested with pandas 0.17.1 and 0.18 on Python 3.4 and Python 3.5
Best run this with Spyder (see https://github.com/spyder-ide/spyder)
Author: Markus Konrad <post@mkonrad.net>
April 2016