This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.util.{Failure, Success} | |
import $ivy.`io.circe::circe-core:0.12.3` | |
import $ivy.`io.circe::circe-generic:0.12.3` | |
import $ivy.`io.circe::circe-parser:0.12.3` | |
import io.circe.{Decoder, Encoder} | |
import io.circe.generic.auto._ | |
import io.circe.syntax._ | |
import io.circe.parser | |
import requests.BaseSession |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SomeClass { | |
private def get(url: String): Future[Option[String]] = | |
for { | |
serviceResponse <- sendGetRequest(url) | |
} yield maybeBody(url, serviceResponse) | |
private def maybeBody(url: String, response: HttpResponse[String]): String = | |
if (response.is2xx) Some(response.body) | |
else None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io._ | |
import java.util.zip.ZipInputStream | |
import geny.Generator | |
import mill._ | |
import mill.define.Target | |
import mill.scalajslib._ | |
object WebpackLib { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do | |
echo "Waiting for other software managers to finish..." | |
sleep 10 | |
done | |
/usr/bin/apt-get "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.2" | |
services: | |
selenium: | |
image: selenium/standalone-chrome | |
ports: | |
- "4444:4444" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/fish | |
set instance $argv[1] | |
set key $argv[2] | |
set tmpdir (mktemp -d) | |
set file $tmpdir/(string replace _ . $key) | |
gcloud compute instances describe $instance --format="value(metadata.$key)" > $file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.{FileReader, Reader} | |
import scala.concurrent.Await | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent.duration.Duration | |
import slick.jdbc.PostgresProfile.api._ | |
import slick.jdbc.PostgresProfile.columnTypes | |
import slick.jdbc.meta.MPrimaryKey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.sql.Connection | |
import org.flywaydb.core.api.migration.jdbc.JdbcMigration | |
import slick.dbio.DBIO | |
import scala.concurrent.duration.Duration | |
import scala.concurrent.{Await, ExecutionContext} | |
abstract class SlickMigration extends JdbcMigration { | |
implicit def executionContext = ExecutionContext.global |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env amm | |
import scala.xml.{Elem, Node, Text, XML} | |
def quoteString(s: String) = | |
'"' + | |
s.replace("\n", "\\n").replace("\"", "\\\"") + | |
'"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fibImperative(index: Int): Int = { | |
var a = 0 | |
var b = 1 | |
var counter = 0 | |
while (counter < index) { | |
val c = a + b | |
a = b |