Skip to content

Instantly share code, notes, and snippets.

View NikoKyriakid's full-sized avatar
🏠
Working from home

Niko Kyriakidis NikoKyriakid

🏠
Working from home
  • AND Digital
  • London, UK
View GitHub Profile
// Import aws-jwt-verify library (https://github.com/awslabs/aws-jwt-verify) as a part of the Lambda Layers.
import { JwtRsaVerifier } from "aws-jwt-verify";
import { JwtExpiredError } from "aws-jwt-verify/error";
import { JwtInvalidClaimError } from "aws-jwt-verify/error";
// IAM default policy to deny all.
// const defaultDenyAllPolicy = {
// Version: "2012-10-17",
// Statement: [
// {
while (true) {
sample.push(...chunk[i]);
this.currentId++;
if (sample.length > 600)
}
@NikoKyriakid
NikoKyriakid / eslint-package-json.js
Created November 29, 2021 15:07 — forked from richardtallent/eslint-package-json.js
Example eslint config in a package.json
"prettier": {
"useTabs": true,
"semi": false,
"singleQuote": false,
"bracketSpacing": true,
"trailingComma": "es5",
"printWidth": 160
},
"eslintConfig": {
"parserOptions": {
We couldn’t find that file to show.
@NikoKyriakid
NikoKyriakid / thread_future.cpp
Last active November 12, 2021 14:25
Create threads or make async calls in C++
#include <thread>
void Test::runMultiThread()
{
std::thread t1(&Test::calculate, this, 0, 10);
std::thread t2(&Test::calculate, this, 11, 20);
t1.join();
t2.join();
}
@NikoKyriakid
NikoKyriakid / instatiateWasm.js
Last active November 10, 2021 16:22
Instatiate Wasm
export const instantiateWasmModule = async (wasmModule, importObject = {}) => {
let response = undefined;
if (WebAssembly.instantiateStreaming) {
response = await WebAssembly.instantiateStreaming(
fetch(wasmModule),
importObject
);
} else {
const fetchAndInstantiateTask = async () => {
@NikoKyriakid
NikoKyriakid / index.mjs
Created November 9, 2021 14:39
Buffer in NodeJS
import * as fs from 'fs/promises';
import path from 'path';
const __dirname = path.resolve();
const filepath = path.join(__dirname, 'sample.txt');
const frames = 64;
const frameSize = 1024;
const packetSize = frames * frameSize;
try {
@NikoKyriakid
NikoKyriakid / README.md
Created July 30, 2020 16:27 — forked from nitaku/README.md
Minimal JSON HTTP server in python

A minimal HTTP server in python. It sends a JSON Hello World for GET requests, and echoes back JSON for POST requests.

python server.py 8009
Starting httpd on port 8009...
curl http://localhost:8009
{"received": "ok", "hello": "world"}
@NikoKyriakid
NikoKyriakid / redirect-push.md
Last active July 30, 2018 19:07 — forked from IanVaughan/README.md
Push branch from one remote into another #git