Skip to content

Instantly share code, notes, and snippets.

View sammy2077's full-sized avatar

Samuel sammy2077

  • Berlin
View GitHub Profile
type GraphProp={[key:string]:string[]}
const buildGraph = (edges:string[][]):GraphProp=>{
const result :GraphProp= {}
for(const edge of edges){
const [a,b]= edge
if(!(a in result)) result[a]=[]
if(!(b in result)) result[b]=[]
result[a].push(b)
result[b].push(a)
@sammy2077
sammy2077 / _aws.graphql
Created July 21, 2021 18:58 — forked from sc0ttdav3y/_aws.graphql
AWS AppSync GraphQL scalars and directives to support type completion and error checking in Webstorm IDEs
# These are here to help the IDE recognise AWS types.
#
# Place this file outside the 'schema' directory so are not pushed to AWS,
# but are still picked up by PhpStorm's GraphQL plugin to help
# validate schemas.
#
# https://docs.aws.amazon.com/appsync/latest/devguide/scalars.html
#
scalar AWSDateTime
scalar AWSDate
@sammy2077
sammy2077 / import_cert.sh
Created April 10, 2021 12:54
File to import certificate to keystore
#!/usr/bin/env sh
KEYSTORE_FILE=./keystore.jks
KEYSTORE_PASS=agweria
HOST=$1
PORT=$2
# get the SSL certificate
openssl s_client -connect "${HOST}":"${PORT}" </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' >"${HOST}".cert
@sammy2077
sammy2077 / TImestamp.kt
Created March 18, 2020 20:06
Getnerate current timestamp in kotlin
import java.time.Instant
import java.time.ZoneId
import java.time.format.DateTimeFormatter
fun main() {
val time=DateTimeFormatter
.ofPattern("yyyyMMddHHmmss")
.withZone(ZoneId.of("Africa/Nairobi"))
.format(Instant.now())
println(time)