Skip to content

Instantly share code, notes, and snippets.

View eugenehp's full-sized avatar
🏦
DeepTech, FinTech, BioTech, Robotics, SEO.

Eugene Hauptmann eugenehp

🏦
DeepTech, FinTech, BioTech, Robotics, SEO.
View GitHub Profile
@eugenehp
eugenehp / test.ts
Created April 5, 2021 20:13
react-native-randomness tests
import * as Randomness from '../index';
describe('Generates random', () => {
it('Generates random bytes', async () => {
const data = await Randomness.random();
expect(data).not.toBe(null);
});
it('Generates random bytes of given length ', async () => {
const data = await Randomness.random(100);
expect(data.length).toBe(100);
@eugenehp
eugenehp / index.ts
Created April 5, 2021 20:13
react-native-randomness main wrapper
import { NativeModules } from 'react-native';
import { decodeAsBytes } from './base64';
const { Randomness } = NativeModules;
export const random = async (length: number = 16): Promise<Uint8Array> => {
const base64: string = await Randomness.random(length);
const data = decodeAsBytes(base64);
return data;
@eugenehp
eugenehp / base64.ts
Created April 5, 2021 20:05
Base64 Typescript
const newLocal =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
/* eslint-disable no-bitwise */
const keyStr = newLocal;
export const encode = (input: string) => {
var output = [];
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
@eugenehp
eugenehp / kubernetes_service_session_affinity.md
Created August 9, 2019 16:34 — forked from fjudith/kubernetes_service_session_affinity.md
Enable Session Affinity (a.k.a Sticky Session) to Kubernetes service
@eugenehp
eugenehp / ...README.md
Created February 7, 2019 09:03 — forked from statico/...README.md
Top-level monorepo TypeScript/JavaScript style with tslint and Prettier

Goals

  • A single style for our projects and others
  • Minimize customization - Any decided-upon style is better than one we can bikeshed
  • Minimize friction - Instead of warnings, sources are formatted automatically on commit and on save inside your editor
  • Minimize files - These three or four files need only be at the top level of the monorepo... nothign in the subdirs

Why X?

  • Prettier, no semicolons - Because you don't need them and they add unnecessary visual clutter. Prettier will figure out when they're needed for you.
@eugenehp
eugenehp / ...README.md
Created February 7, 2019 07:31 — forked from statico/...README.md
Knex & TypeScript

Goals

  • Make all parts of Knex TypeScript-safe
@eugenehp
eugenehp / circleci.yml
Created January 21, 2019 21:28 — forked from statico/circleci.yml
Node.js 10 + PostgreSQL CircleCI config
version: 2
workflows:
version: 2
build:
jobs:
- test
jobs:
test:
@eugenehp
eugenehp / jwtRS256.sh
Created October 9, 2018 19:38 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@eugenehp
eugenehp / index.js
Created August 22, 2018 13:26 — forked from digitalkaoz/index.js
gatsby in aws lambda
const AWS = require("aws-sdk");
const {link} = require("linkfs");
const mock = require('mock-require');
const fs = require('fs');
const tmpDir = require('os').tmpdir();
exports.handler = (event, context) => {
rewriteFs();
invokeGatsby(context);
}