Skip to content

Instantly share code, notes, and snippets.

View fuCtor's full-sized avatar

Alexey Shcherbakov fuCtor

View GitHub Profile
@rudogma
rudogma / MultiDimensional.scala
Last active June 16, 2017 12:14
Using tagged types as alternative (with no runtime overhead) to Compile time dimensional analysis at http://typelevel.org/blog/2017/06/13/libra.html
import supertagged._
/*** ONE TIME PREDEF **/
trait Opp {
type Operation
type Divide <: Operation
type Multiply <: Operation
}
function dump() {
time=$(date '+%H_%M_%S');
date=$(date '+%Y_%m_%d');
database=$1;
dumps_dir="$HOME/dumps";
mkdir -p "$dumps_dir/$date";
dumpfile=$dumps_dir/$date/$time"_"$database"_dump".psql.gz
pg_dump $database -W -U ontheway --no-privileges --clean --exclude-table=schema_migrations | gzip > $dumpfile;

Ratpack Production Tunings

# cat /etc/security/limits.conf

*         hard    nofile      500000
*         soft    nofile      500000
root      hard    nofile      500000
root      soft    nofile      500000
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@nelanka
nelanka / ShardRegionGracefulShutdownExperiment.scala
Last active January 2, 2018 17:03
Shard Region Graceful Shutdown Experiment
package net.nelanka.akka_sandbox.cluster_sharding.experiments
import scala.concurrent.Await
import scala.concurrent.duration._
import scala.language.postfixOps
import scala.util.{Failure, Success}
import akka.actor.{Actor, ActorRef, ActorSystem, FSM, Props, Terminated}
import akka.cluster.Cluster
import akka.cluster.sharding.ShardCoordinator.LeastShardAllocationStrategy
@beshkenadze
beshkenadze / Ruby_finance_testcase.md
Created September 25, 2015 15:03
Тестовое задание для Ruby-разработчика

Задание

Реализовать на Ruby с использованием Rails приложение со следующим функционалом:

  1. Регистрация / авторизация пользователей.
  2. Создание портфеля акций (5-6 акций достаточно) для пользователя: стандартный CRUD.
  3. Данные должны скачиваться с Yahoo Finance.
  4. Сделать вывод графика "стоимость портфеля от времени" за 2 последних года по выбранным в п.2 акциям.

Требования

@ngpestelos
ngpestelos / remove-docker-containers.md
Last active March 5, 2024 20:45
How to remove unused Docker containers and images

May 8, 2018

I wrote this four years ago, so instead use this command:

$ docker rmi $(docker images -q -f dangling=true)
@jbgo
jbgo / debug_system_stack_error.md
Created January 9, 2013 15:08
debug SystemStackError in ruby 1.9

This is how I debug SystemStackError when there is no stack trace.

My first attempt was:

begin
  a_method_that_causes_infinite_recursion_in_a_not_obvious_way
rescue SystemStackError
  puts caller
end
@higgis
higgis / foos_controller.rb
Created September 27, 2012 11:33
Rails: Default format using header-based content negotiation
class FoosController < ApplicationController
respond_to :atom, :api_v1
before_filter :set_default_format
def index
@foos = Foo.all
respond_to do |format|
format.xml { render :xml => @foos.to_xml }
format.api_v1 { render :json => @foos.to_json }
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active March 18, 2024 05:38
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname