Skip to content

Instantly share code, notes, and snippets.

View pshirshov's full-sized avatar
😹

Paul S. pshirshov

😹
View GitHub Profile
@pshirshov
pshirshov / services.scala
Last active April 4, 2018 23:17
IDL: services model
package com.github.pshirshov.izumi.idealingua.runtime.services
import scala.concurrent.{ExecutionContext, Future}
import scala.util.Try
import scala.language.{higherKinds, implicitConversions}
//--------------------------------------------------------------------------
// Runtime: unopinionated part
trait ServiceResult[R[_]] {
@pshirshov
pshirshov / nixos_openldap_radius.md
Last active October 10, 2024 12:24
FreeRadius, OpenLDAP and Samba on NixOS howto
  1. Install NixOS
  2. Add required packages

In /etc/nixos edit configuration.nix

  imports =
    [  # ...
      ./ldapserver.nix
    ];
@pshirshov
pshirshov / tutorial.md
Created June 1, 2018 08:51 — forked from Hengjie/tutorial.md
How to passthrough SATA drives directly on VMWare ESXI 6.5 as RDMs

How to passthrough SATA drives directly on VMWare EXSI 6.5 as RDMs

There aren't many tutorials about this, the only tutorials I've found were about passing through entire PCIe cards to VMs, or refered to old ESXI versions (below 6.5) that used a more comprehensive desktop client instead of the web app. In v6.5, the web app was introduced and the desktop client was deprecated. You used to be able to setup RDMs in the desktop client, but with the introduction of the web console, this is no longer the case. This tutorial shows you how to pass SATA HDDs to the virtual machine on VMWare ESXI 6.5. This tutorial is partially based on VMWare's own KB and the now deprecated Forza IT blog post.

Summary

We attach the SATA HDDs as a RDM (Raw Device Mapper) into an existing virtual disk in the command line, then on the web app

@pshirshov
pshirshov / lvm_shrink.md
Last active June 2, 2018 23:17
LVM: shrink volume

Copy partition table:

sfdisk -d /dev/sda > part_table
sfdisk /dev/sda < part_table

Copy boot partition

dd if=/dev/sda1 of=/dev/sdb1 bs=50M
@pshirshov
pshirshov / modules_load
Created June 3, 2018 20:04
Old genkernel customization
# Module groups for genkernel initramfs auto-loading
# RAID
MODULES_ATARAID=""
#MODULES_DMRAID="dm-mod dm-mirror dm-crypt"
MODULES_DMRAID=""
MODULES_LVM=""
#MODULES_MDADM="dm-mod dm-snapshot dm-mirror dm-crypt dm-bbr raid0 raid1 raid456 raid5 raid6 raid10"
MODULES_MDADM=""
@pshirshov
pshirshov / scala_inference_failure.scala
Last active June 15, 2018 17:15
Failing scala inference, works in dotty
// works in dotty, not in scala
trait Provider[P] {
def provide: P
}
implicit object IntProvider extends Provider[Int] {
override def provide = 1
}
implicit object StringProvider extends Provider[String] {
@pshirshov
pshirshov / scalac_invoke.scala
Created July 3, 2018 21:30
scala.tools.nsc invokation example
private def isRunningUnderSbt: Boolean = {
Option(System.getProperty("java.class.path")).exists(_.contains("sbt-launch.jar"))
}
import scala.tools.nsc.{Global, Settings}
val settings = new Settings()
settings.d.value = ctarget.toString
settings.feature.value = true
settings.warnUnused.add("_")
@pshirshov
pshirshov / sbtconfig.sh
Last active January 4, 2019 22:13
sbt plugins to enable globally
cat > ~/.sbt/1.0/plugins/build.sbt <<EOL
scalaVersion := "2.12.8"
// https://github.com/coursier/coursier
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.1.0-M8")
//https://github.com/aiyanbo/sbt-dependency-updates
addSbtPlugin("org.jmotor.sbt" % "sbt-dependency-updates" % "1.1.13")
// https://github.com/sbt/sbt-dirty-money
@pshirshov
pshirshov / bifunctorio.scala
Created September 13, 2018 10:40
Bifunctor IO wrapper for DIStage workshop
import scalaz.zio.{ExitResult, IO, RTS, Schedule}
import scala.concurrent.duration.{Duration, FiniteDuration}
import scala.language.implicitConversions
import scala.util.{Failure, Success, Try}
trait BifunctorIO[R[+ _, + _]] extends {
type Or[+E, +V] = R[E, V]
type Just[+V] = R[Nothing, V]