Skip to content

Instantly share code, notes, and snippets.

View mannharleen's full-sized avatar
👽

Harleen Mann mannharleen

👽
View GitHub Profile
# this is an example of the Uber API
# as a demonstration of an API spec in YAML
swagger: "2.0"
info:
title: All APIs
description: Move your app forward with the Uber API
version: "1.0.0"
# the domain of the service
host: api.uber.com
# array of all schemes that your API supports
@mannharleen
mannharleen / main.js
Created November 8, 2020 10:55
playing around with node-sqlite
const sqlite3 = require("sqlite3");
const { open } = require("sqlite");
(async () => {
// open the database
const db = await open({
filename: '/tmp/db',
driver: sqlite3.cached.Database //sqlite3.Database
})
const db1 = await open({
// host this code on IPv6 website with "c" in IP.
<span id=ifr>
<iframe></iframe>
</span>
<script>
function sleep(ms) {
return new Promise(r => setTimeout(r, ms));
}
@mannharleen
mannharleen / example.md
Created July 7, 2020 04:32 — forked from pgolding/example.md
Passing AWS Lambda Function parameters using the ClientContext object in Python

Boto3 documentation for lambda_client.invoke suggests it is possible to pass data via the ClientContext object as a string.

The string is required to be base64 encoded JSON.

To encode such a string, use:

import baseb4
base64.b64encode(b'<string>').decode('utf-8')
const myObject = {
myArrowFunction: null,
myMethod: function () {
this.myArrowFunction = () => { console.log(this) };
}
};
myObject.myMethod() // this === myObject
myObject.myArrowFunction() // this === myObject
mkdir ms1
cd ms1
sls login
sls init
sls
sls deploy
const { graphql, buildSchema } = require("graphql")
let schema = buildSchema(`
type Query {
hello: Book
}
type Book {
id: ID!
name: String!
drop table originflowjobs;
create table originflowjobs (id SERIAL PRIMARY KEY, user_id text NOT NULL, flow_id text NOT NULL, run_id text unique NOT NULL, flow_label text, flow_info text, status text NOT NULL, created_ts timestamp NOT NULL, updated_ts timestamp NOT NULL, custom_json jsonb);
CREATE INDEX index_user_id_flow_id ON originflowjobs(user_id, flow_id, run_id);
ALTER TABLE public.originflowjobs ENABLE ROW LEVEL SECURITY;
CREATE ROLE testuser1 WITH LOGIN PASSWORD 'testuser1';
GRANT select, insert, update, delete ON TABLE originflowjobs TO testuser1;
GRANT USAGE, SELECT ON SEQUENCE originflowjobs_id_seq TO testuser1;
CREATE POLICY originflowjobs_userId
ln -n -s /mnt/c/Users/mannh/go /home/mannh/