Skip to content

Instantly share code, notes, and snippets.

View jiraguha's full-sized avatar

jiraguha

View GitHub Profile
@jiraguha
jiraguha / SpykBeanKafka.kts
Last active February 25, 2021 18:48
SpykBeanKafka
@SpykBean
private lateinit var colorProducer: ColorProducer
@BeforeEach
fun init() {
val topic = "colors-${UUID.randomUUID()}"
// note that topic is a getter only
every { colorProducer.topic } answers { topic }
}
@jiraguha
jiraguha / RSocketErrorData.md
Last active November 28, 2020 18:34
RSocket error data - URL base convention for managing errors

Intro

ERROR Frame (0x0B) is used for errors on individual requests/streams as well as connection errors and in response to SETUP frames.

Frame Contents

     0                   1                   2                   3
     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@jiraguha
jiraguha / deno-core-plugin.md
Last active August 11, 2020 20:16
Creating deno 🦕 Rust 🦀 plugins usable in the JS/TS scripts [ short tuto]

Just exploring how deno Rust plugins can be used. !!! warning the feature is still instable!!!

Clone the deno source & go to deno/test_plugin

The repo is structure as following:

test_plugin
├── Cargo.toml
@jiraguha
jiraguha / deno-script.md
Last active December 21, 2023 14:19
Deno for scripting

Deno for scripting

Foreword

It is largely inspired by kscript. The idea is to leverage the scripting abilities of javascript using Deno. I feel that scripting can be so much fun with Deno as:

  • It can import modules from any location on the web,
  • It is secure by default. Imported module can run in sandbox.
  • It is Supports TypeScript out of the box.
  • It is much more that Node
@jiraguha
jiraguha / learning.md
Last active July 2, 2020 10:38
Learning level

Language level

  • Phase I: Approach
  • Phase II: Advance benchmark
  • Phase III: Expert library designer & Effective code
  • Phase IV: Compiler Approach & Underling Design and specs & optimization

Expert - Delibarate Practice Level

  • E0 : Can't "do"
  • E1 : Can "do" with effort
@jiraguha
jiraguha / kubeCG.md
Created July 2, 2020 09:52
kubernetes on google cloud
@jiraguha
jiraguha / .js
Created May 7, 2020 15:47
Builder in js
class Rectangle {
constructor(hauteur, largeur, color) {
this.hauteur = hauteur;
this.largeur = largeur;
this.color = color;
}
}
class RectangleBuilder {
withHauteur(hauteur) {
@jiraguha
jiraguha / ProblemWebExceptionHandler.kt
Created April 17, 2020 20:18
Try have exception advising in spring for RouterFunction (webflux)
@Component
@Order(-2)
class GlobalErrorWebExceptionHandler(
private val configurer: ServerCodecConfigurer,
private val exceptionAdvisor: ExceptionAdvisor,
private val errorAttributes: ErrorAttributes,
private val resourceProperties: ResourceProperties,
private val applicationContext: ApplicationContext)
: AbstractErrorWebExceptionHandler(errorAttributes, resourceProperties, applicationContext) {
@jiraguha
jiraguha / toPascalCase.kt
Created April 9, 2020 03:11
Convert Snake & Spinal to PascalCase in kotlin
val str = "my-name_is";
val result = str.replace("(-.)|(_.)".toRegex()) {
it.value[1].toString()
.toUpperCase()
}.capitalize()
println(result)

Deploy a fullstack js app on aws

Intro

There are many way to do it. Some of them are more efficient that others. Here are some paths to explore.

Fast and dirty: Every thing in on a EC2

  1. Create EC2 instance
  2. ssh in EC2
  3. Install everything (git, node, mongo)
  4. Open the inbound to the world
  5. Create a route53 and link it to you DNS

Usefull link