Skip to content

Instantly share code, notes, and snippets.

View PKOfficial's full-sized avatar

Prabhat Kashyap PKOfficial

View GitHub Profile
@PKOfficial
PKOfficial / tree.scala
Created February 16, 2024 11:41
Tree like command using scala-cli
//> using dep "com.lihaoyi::os-lib:0.9.3"
import os._
object Tree extends App {
def listFiles(path: os.Path, depth: Int = 0): Unit = {
if (os.isDir(path)) {
for (subPath <- os.list(path)) {
println(" " * depth + subPath.last)
case class BinaryTree(info: String, left: Option[BinaryTree], right: Option[BinaryTree])
object Application extends App {
val firstLeftFirstLeft = BinaryTree("firstLeftFirstLeft", None, None)
val firstLeftFirstRight = BinaryTree("firstLeftFirstRight", None, None)
val firstRightFirstLeft = BinaryTree("firstRightFirstLeft", None, None)
val firstLeft = BinaryTree("firstLeft", Some(firstLeftFirstLeft), Some(firstLeftFirstRight))
---
- hosts: webservers
vars:
http_port: 80
max_clients: 200
remote_user: root
tasks:
- name: ensure apache is at the latest version
yum: name=httpd state=latest
- name: write the apache config file
[india]
host1
host2
[japan]
host3
host4
[asia:children]
India
all:
hosts:
mail.example.com
children:
webservers:
hosts:
foo.example.com:
bar.example.com:
dbservers:
hosts:
[mailservers]
mail.example.com
[webservers]
foo.example.com
bar.example.com
[dbservers]
one.example.com
two.example.com
blockchain0 -- bd4824d8ee63fc82392a6441444166d22ed84eaa6dab11d4923075975acab938
blockchain1 -- db0b9c1cb5e9c680dfff7482f1a8efad0e786f41b6b89a758fb26d9e223e0a10
blockchain2 -- 8f0532cd22055fb7599aa48f38501dcd46e61712ab49a02f840f5545830e9260
blockchain3 -- eb61c3724d6da33605084d2d232bba0563cb82f4ad82c101b42f23c2e86277ef
blockchain4 -- 1af101f70897bf501779b7b2e413ae7144aba5b97e24890c71ba2a1d9c518d20
import scala.concurrent._
import scala.concurrent.duration._
import akka.actor.{Actor, ActorRef, ActorSystem, Props}
import akka.pattern.ask
import akka.util.Timeout
// KillMe case object to stop an actor
case object KillMe