Skip to content

Instantly share code, notes, and snippets.

View izmailoff's full-sized avatar
🎯
Focusing

Aleksey Izmailov izmailoff

🎯
Focusing
View GitHub Profile
@izmailoff
izmailoff / git_mergetool_setup.sh
Created April 8, 2020 02:27
git mergetool setup
sudo apt-get update
sudo apt-get install kdiff3
git config --global --add merge.tool kdiff3
git config --global --add mergetool.kdiff3.path "/usr/bin/kdiff3"
git config --global --add mergetool.kdiff3.trustExitCode false
git config --global --add mergetool.prompt false
git config --global --add diff.guitool kdiff3
git config --global --add difftool.kdiff3.path "/usr/bin/kdiff3"
@izmailoff
izmailoff / postgres_stats.sql
Created February 24, 2020 06:41
Postgres DB stats
-- analyze DB for more precise stats
VACUUM (FULL, ANALYZE);
-- get row counts for all tables (option 1)
SELECT
nspname AS schemaname,relname,reltuples
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE
nspname NOT IN ('pg_catalog', 'information_schema') AND
@izmailoff
izmailoff / latest_docs.js
Created November 27, 2019 05:42
Mongo shell script to get latest docs in each collection
var cols = db.getCollectionNames();
cols.forEach(x => {
var res = db[x].find({}).sort({_id: -1}).limit(3);
print(x + ": ");
res.forEach(x => print(x._id + " is " + x._id.getTimestamp()));
print();
}
);
@izmailoff
izmailoff / virtual python environment.sh
Last active May 16, 2022 08:14
Setup virtual python environment
# OSX specific install commands:
brew install pyenv
pyenv install 3.6.8
# or if fails:
CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install -v 3.6.8
# the rest of the commands work both on OSX and Linux:
virtualenv -p /Users/alex/.pyenv/versions/3.6.8/bin/python venv
source venv/bin/activate
@Yogendra0Sharma
Yogendra0Sharma / README.md
Created January 12, 2017 08:43 — forked from genomics-geek/README.md
Setting up a Dockerized web application with Django REST APIs, ReactJS with Redux pattern, and Webpack Hot Reloading! Mouthful.

Guide on how to create and set up a Dockerized web app using Django REST APIs and ReactJS

Hopefully this will answer "How do I setup or start a Django project using REST Framework and ReactJS?"

I created this because it was SUCH a pain in the ass setting up a project using all the latest technologies. After some research, I figured it out and have it working. The repo that implements this is located here. Feel free to use it as a boilerplate ;)

Main features:

  • Django REST APIs
  • ReactJS with Redux Pattern
  • Webpack module bundler manager
@chrisdone
chrisdone / expression_problem.hs
Created November 2, 2016 11:34 — forked from elnygren/expression_problem.clj
Solving the Expression Problem with Haskell
{-# LANGUAGE NamedFieldPuns #-}
-- The Expression Problem and my sources:
-- http://stackoverflow.com/questions/3596366/what-is-the-expression-problem
-- http://blog.ontoillogical.com/blog/2014/10/18/solving-the-expression-problem-in-clojure/
-- http://eli.thegreenplace.net/2016/the-expression-problem-and-its-solutions/
-- http://www.ibm.com/developerworks/library/j-clojure-protocols/
-- To begin demonstrating the problem, we first need some
@elnygren
elnygren / expression_problem.clj
Last active December 3, 2022 16:33
Solving the Expression Problem with Clojure
; The Expression Problem and my sources:
; http://stackoverflow.com/questions/3596366/what-is-the-expression-problem
; http://blog.ontoillogical.com/blog/2014/10/18/solving-the-expression-problem-in-clojure/
; http://eli.thegreenplace.net/2016/the-expression-problem-and-its-solutions/
; http://www.ibm.com/developerworks/library/j-clojure-protocols/
; To begin demonstrating the problem, we first need some
; "legacy code" with datastructures and functionality:
@karpathy
karpathy / pg-pong.py
Created May 30, 2016 22:50
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@izmailoff
izmailoff / genDownloadCommands.sh
Created February 4, 2016 06:38
Generates unix commands (wget, youtube-dl) to download files based on the links found on a web page.
#!/bin/sh
exec scala "$0" "$@"
!#
import scala.io.Source
val url = "https://work.caltech.edu/lectures.html"
val html = Source fromURL(url) mkString
val href = """<a href="\s*(.+?)\s*">""".r
val links = (for (m <- href findAllMatchIn html) yield m group 1) toList
@OlegIlyenko
OlegIlyenko / OptionsExample.scala
Created June 21, 2015 12:42
Example of akka-http server with generic OPTIONS method handling
import akka.actor.ActorSystem
import akka.stream.ActorFlowMaterializer
import akka.http.scaladsl.model.headers._
import akka.http.scaladsl.Http
import akka.http.scaladsl.server._
import akka.http.scaladsl.model.StatusCodes._
import akka.http.scaladsl.server.Directives._
object OptionsMethod extends App {