Skip to content

Instantly share code, notes, and snippets.

@bhameyie
bhameyie / SourceCodeGenerator.scala
Last active July 1, 2020 20:47
Only generate tables for a single schema
import slick.codegen.SourceCodeGenerator
import slick.jdbc.JdbcProfile
import slick.model.Model
import scala.concurrent.{Await, ExecutionContext}
import scala.concurrent.duration.Duration
object SourceCodeGenerator {
@bhameyie
bhameyie / halFormBuilder.js
Created May 1, 2017 12:13
Rendering HAL Extension
function buildForm(containerId,obj) {
if (!obj["_presentable"]) {
return;
}
var presentable = obj["_presentable"];
var links = obj["_links"];
var form = document.createElement("form");
@bhameyie
bhameyie / All.cs
Created May 1, 2017 12:11
Sample description of HAL extension idea
public enum LinkKind
{
Fetch,
Save,
Update
}
public enum Restrictions
{
Required,
@bhameyie
bhameyie / haproxy.cfg
Last active November 28, 2023 22:30
Sample haproxy config
##based on Mesosphere Marathon's servicerouter.py haproxy config
global
daemon
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
tune.ssl.default-dh-param 2048
defaults
@bhameyie
bhameyie / cloudform.template.json
Last active August 29, 2015 14:24
cheapo dcos template test (do not use in production!!!!)
{"Metadata":{"DcosImageCommit":"fb58e5c0a02fe44e8df2baf92de72bea3030f34b","TemplateGenerationDate":"2015-06-05 23:02:57.870011"},"Description":"Launching the Mesosphere DCOS cluster","Parameters":{"AcceptEULA":{"Type":"String","Description":"Please read and agree to our EULA: https://docs.mesosphere.com/community-edition-eula/","AllowedValues":["Yes"]},"KeyName":{"Type":"AWS::EC2::KeyPair::KeyName","Description":"Name of SSH key to link"},"PublicSlaveInstanceCount":{"Type":"Number","Description":"Number of public slave nodes to launch","Default":"1"},"SlaveInstanceCount":{"Type":"Number","Description":"Number of slave nodes to launch","Default":"5"},"AdminLocation":{"MinLength":"9","AllowedPattern":"^([0-9]+\\.){3}[0-9]+\\/[0-9]+$","ConstraintDescription":"must be a valid CIDR.","Type":"String","Description":"The IP range to whitelist for admin access.","Default":"0.0.0.0/0","MaxLength":"18"}},"Mappings":{"NATAmi":{"eu-central-1":{"default":"ami-204c7a3d"},"eu-west-1":{"default":"ami-3760b040"},"ap-southeast-
@bhameyie
bhameyie / Client.scala
Last active August 29, 2015 14:14
Vanilla Akka Cluster
object Main {
def main(args: Array[String]): Unit = {
val systemName = "47Ronin"
val system = ActorSystem(systemName)
val mediator = DistributedPubSubExtension(system).mediator
mediator ! Publish(Channels.printingChannel,
PrintIt("print it I say")) // to send to all
mediator ! Send(Channels.printingChannel,
PrintIt("print it I say")) // to send to a single printer dude
}
@bhameyie
bhameyie / Client.scala
Created February 6, 2015 02:16
Akka Remoting Pitfall
object Main {
def main(args: Array[String]): Unit = {
val addr= "akka.tcp://47Ronin@servermachine:9551/user/printerDude"
val system = ActorSystem()
val printerDude = system.actorSelection(addr)
printerDude ! PrintIt("still printing")
}
}
@bhameyie
bhameyie / Main.scala
Created February 6, 2015 01:47
Vanilla Akka usage
object Main {
def main(args: Array[String]): Unit = {
val systemName = "47Ronin"
val system = ActorSystem(systemName)
val printer = system.actorOf(Props[PrinterDude], "printerDude")
printer ! PrintIt("Hello World!")
}
}
@bhameyie
bhameyie / run.sh
Created January 16, 2015 21:26
running terraform
terraform get
terraform plan -out terraform.tfplan
@bhameyie
bhameyie / gist:22688d3d6f1c4d2333bd
Created January 16, 2015 21:10
Sample vms usage
provider "aws" {
access_key = "${var.aws_accesskey}"
secret_key = "${var.aws_secretkey}"
region = "us-east-1"
}
module "appsvr1" {
source = "../app_servers"
region = "us-east-1"
memory = "t2.small"