Skip to content

Instantly share code, notes, and snippets.

View pvoznenko's full-sized avatar
👟
offline is the new luxury

Pavlo Voznenko pvoznenko

👟
offline is the new luxury
View GitHub Profile
@zulhfreelancer
zulhfreelancer / upgrade.md
Last active February 17, 2023 00:42
How to upgrade Heroku Postgres database plan?
  1. Assuming you have multiple Heroku apps and Git remote like so:
development https://git.heroku.com/xxx.git (fetch)
development https://git.heroku.com/xxx.git (push)
origin      git@bitbucket.org:xxx/xxx.git  (fetch)
origin      git@bitbucket.org:xxx/xxx.git  (push)
production  https://git.heroku.com/xxx.git (fetch)
production  https://git.heroku.com/xxx.git (push)
staging https://git.heroku.com/xxx.git (fetch)
@pvoznenko
pvoznenko / circe-loop-json-object-example.md
Last active May 11, 2018 19:25
How to loop through json object and change values with circe, scala

How to go through json object and change values with Circe in Scala

Small gist with some demo trait that shows an example on how to loop through json object and change values with circe in Scala.

Code example you can find below at circe-loop-json-object-example.scala.

The input JSON for test is kinda in in DynamoDB dump format:

@cb372
cb372 / jargon.md
Last active May 14, 2024 03:45
Category theory jargon cheat sheet

Category theory jargon cheat sheet

A primer/refresher on the category theory concepts that most commonly crop up in conversations about Scala or FP. (Because it's embarassing when I forget this stuff!)

I'll be assuming Scalaz imports in code samples, and some of the code may be pseudo-Scala.

Functor

A functor is something that supports map.

@xuwei-k
xuwei-k / PlayMini.scala
Last active February 20, 2016 13:14
came back play mini!
#!/usr/bin/env scalas
/***
scalaVersion := "2.11.7"
libraryDependencies += "com.typesafe.play" %% "play-netty-server" % "2.4.6"
*/
import play.core.server._
import play.api.routing.sird._
import play.api.mvc._
@Umkus
Umkus / discovery@.service
Last active August 1, 2016 17:18
CoreOS service discovery using flannel, etcd and SkyDNS.
[Unit]
Description=Service discovery for %i
After=%i.service
Requires=%i.service
[Service]
Restart=always
Environment="SLEEP=5"
Environment="TTL=10"
Environment='FORMAT="{{ .NetworkSettings.IPAddress }}"'
@jbfarez
jbfarez / README.md
Last active March 10, 2020 15:56
Dashing Catchpoint® widget

Preview

Screenshot

Description

Display your website availability / performances from Catchpoint® SaaS service.

This using the Catchpoint® Pull API.

@kchida
kchida / gist:d1c15f3968f4f8272c49
Created July 17, 2014 05:06
etcd vs consul vs ???
- What do Etcd, Consul, and Zookeeper do?
- Service Registration:
- Host, port number, and sometimes authentication credentials, protocols, versions
numbers, and/or environment details.
- Service Discovery:
- Ability for client application to query the central registry to learn of service location.
- Consistent and durable general-purpose K/V store across distributed system.
- Some solutions support this better than others.
- Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
- Centralized locking can be based on this K/V store.
@jeffsteinmetz
jeffsteinmetz / gist:063bd3237033f3af2ed9
Last active October 20, 2023 22:20
Generate Unique, Hashed, Random Token in Scala for use in API calls or as an OAuth Token Bearer
import scala.util._
import java.security.SecureRandom
import java.security.MessageDigest
/*
* Generates a Bearer Token with a length of
* 32 characters (MD5) or 64 characters (SHA-256) according to the
* specification RFC6750 (http://tools.ietf.org/html/rfc6750)
*
* Uniqueness obtained by hashing system time combined with a
@staltz
staltz / introrx.md
Last active July 22, 2024 09:31
The introduction to Reactive Programming you've been missing
@viktorklang
viktorklang / Future-retry.scala
Last active July 23, 2023 23:48
Asynchronous retry for Future in Scala
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import akka.pattern.after
import akka.actor.Scheduler
/**
* Given an operation that produces a T, returns a Future containing the result of T, unless an exception is thrown,
* in which case the operation will be retried after _delay_ time, if there are more possible retries, which is configured through
* the _retries_ parameter. If the operation does not succeed and there is no retries left, the resulting Future will contain the last failure.