Skip to content

Instantly share code, notes, and snippets.

View akrisanov's full-sized avatar

Andrey Krisanov akrisanov

View GitHub Profile
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="old@email"
CORRECT_NAME="Correct Name"
CORRECT_EMAIL="correct@email"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
@akrisanov
akrisanov / application.ex
Created February 13, 2019 16:35
Adding Ecto To An Elixir Application Without Phoenix
defmodule MyApp.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
def start(_type, _args) do
# List all child processes to be supervised
children = [
@akrisanov
akrisanov / Flexible Dockerized Phoenix Deployments.md
Created September 21, 2018 22:45 — forked from jswny/Flexible Dockerized Phoenix Deployments.md
A guide to building and running zero-dependency Phoenix (Elixir) deployments with Docker. Works with Phoenix 1.2 and 1.3.

Prelude

I. Preface and Motivation

This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.

For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai

@akrisanov
akrisanov / Gemfile
Last active August 30, 2018 20:48
Annotated Gemfile
## Backgroud jobs, queue ---------------------------
gem "daemons", "1.2.4" # Aug 2016
gem "delayed_job", "4.1.3" # May 2017
gem "delayed_job_active_record", "4.1.2" # May 2017
gem "delayed_job_web", "1.4" # May 2017
gem "stomp", "1.4.4" # Jun 2017
## Logs, metrics -----------------------------------
$ gem install license_finder
$ license_finder
........................................
Dependencies that need approval:
bundler, 1.12.5, MIT
minitest, 5.10.2, MIT
rake, 12.0.0, MIT
simplecov, 0.13.0, MIT
simplecov-html, 0.10.1, MIT
import re
import matplotlib.pyplot as plt
import seaborn as sns
def word_in_text(word, text):
word = word.lower()
text = tweet.lower()
match = re.search(word, text)
if match:
@akrisanov
akrisanov / asyncio-async-await.py
Last active September 11, 2018 10:06 — forked from miguelgrinberg/asyncio-async-await.py
Python Async Examples
import asyncio
loop = asyncio.get_event_loop()
async def hello():
await asyncio.sleep(3)
print('Hello!')
if __name__ == '__main__':
loop.run_until_complete(hello())
@akrisanov
akrisanov / data_camp5.py
Last active July 21, 2018 18:47
DataCamp: Importing Data in Python (Part 1)
import numpy
# Print the keys of the MATLAB dictionary
print(mat.keys())
# Print the type of the value corresponding to the key 'CYratioCyt'
print(type(mat['CYratioCyt']))
# Print the shape of the value corresponding to the key 'CYratioCyt'
print(numpy.shape(mat['CYratioCyt']))
# Define plot_pop()
def plot_pop(filename, country_code):
# Initialize reader object: urb_pop_reader
urb_pop_reader = pd.read_csv(filename, chunksize=1000)
# Initialize empty DataFrame: data
data = pd.DataFrame()
# Iterate over each DataFrame chunk
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(123)
all_walks = []
# Simulate random walk 250 times
for i in range(250) :
random_walk = [0]
for x in range(100) :