Skip to content

Instantly share code, notes, and snippets.

View pshirshov's full-sized avatar
😹

Paul S. pshirshov

😹
View GitHub Profile
@pshirshov
pshirshov / Markdium-Shell.bash
Created October 7, 2019 19:27
Markdium-Monorepo or Multirepo? Role-Based Repositories
# Prepares workspace for all our components
project prepare *
# Prepares workspace to work on `billing` and `analytics`
# Pulls in `sdk` as well
project prepare +billing +analytics
# Prepares workspace to work on `sdk`, `iam` and `catalog`
project prepare :infrastructure
@pshirshov
pshirshov / Markdium-Shell.bash
Created October 8, 2019 08:31
Markdium-Monorepo or Multirepo? Role-Based Repositories
# Prepares workspace for all our components
project prepare *
# Prepares workspace to work on `billing` and `analytics`
# Pulls in `sdk` as well
project prepare +billing +analytics
# Prepares workspace to work on `sdk`, `iam` and `catalog`
project prepare :infrastructure
@pshirshov
pshirshov / Markdium-Shell.bash
Created October 8, 2019 08:31
Markdium-Monorepo or Multirepo? Role-Based Repositories
# generates pure JVM project
./sbtgen.sc
# generates JVM/JS cross-project
./sbtgen.sc --js
# generates pure JVM project for just one of our components
./sbtgen.sc -u distage
@pshirshov
pshirshov / Markdium-Scala.scala
Created October 8, 2019 08:31
Markdium-Monorepo or Multirepo? Role-Based Repositories
lazy val conditionalProject = if (condition) {
project.in(...)
} else {
null
}
@pshirshov
pshirshov / PrefixTree.scala
Created October 31, 2019 15:38
Simple prefix search tree (trie)
case class PrefixTree[K, V](values: Seq[V], children: Map[K, PrefixTree[K, V]]) {
def findSubtree(prefix: List[K]): Option[PrefixTree[K, V]] = {
prefix match {
case Nil =>
Some(this)
case head :: tail =>
children.get(head).map(_.findSubtreeOrRoot(tail))
}
}
class GoogleClient() {
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest
import com.google.api.client.http.javanet.NetHttpTransport
import com.google.api.client.json.jackson2.JacksonFactory
import com.google.api.services.oauth2.Oauth2
import com.google.auth.http.HttpCredentialsAdapter
import com.google.auth.oauth2.{AccessToken, UserCredentials}
import scala.jdk.CollectionConverters._
// shared data
@pshirshov
pshirshov / fixes.md
Created October 25, 2020 20:05 — forked from spaced/fixes.md
wayland tweaks

scaling hidpi: everything is very small needed steps:

  • settings -> display -> scale = 1
  • settings -> enforce fonts dpi -> 162dpi
  • settings -> symbols -> scale up

meta/win/idea issue:

  • settings -> input -> keyboard -> extended -> toggle left alt with left win
  • idea: help -> custom properties:
@pshirshov
pshirshov / pixie.nix
Created January 26, 2022 13:18
NixOS / flakes / pixiecore
services.pixiecore =
let
key = "...";
nixpkgs = lib.cleanSource pkgs.path;
nixos = (import "${lib.cleanSource pkgs.path}/nixos/lib/eval-config.nix" {
system = "x86_64-linux";
modules =
[
"${lib.cleanSource pkgs.path}/nixos/modules/installer/netboot/netboot.nix"
({ pkgs, ... }: {
@pshirshov
pshirshov / config.nix
Created October 30, 2022 11:35
pxe/nixos
{ config, pkgs, lib, ... }:
{
#...
services.pixiecore = let
nixos = (import "${lib.cleanSource pkgs.path}/nixos/lib/eval-config.nix" {
system = "x86_64-linux";
modules = [ ./pxe.nix ];
});
build = nixos.config.system.build;
@pshirshov
pshirshov / s3clean.sh
Created December 28, 2022 18:13
s3 mass bucket removal
#!/usr/bin/env bash
set -x
set -e
PREFIX=$1
buckets=$(aws s3api list-buckets | jq -r '.Buckets | map(.Name) | .[] | select(. | startswith("'${PREFIX}'-"))')
for bucket in $buckets; do
aws s3 rb s3://$bucket --force