Skip to content

Instantly share code, notes, and snippets.

View moshest's full-sized avatar

Moshe Simantov moshest

View GitHub Profile

Exmaple of a page break


another page

@moshest
moshest / p2p-list.md
Last active February 13, 2022 09:33
A collection of peer-to-peer decentralized projects.
@moshest
moshest / appspec.yml
Last active October 13, 2021 18:09
Node.js Project on AWS CodeDeploy CentOS
version: 0.0
os: linux
files:
- source: /
destination: /home/ec2-user/node
permissions:
- object: /home/ec2-user
owner: ec2-user
group: ec2-user
type:
@moshest
moshest / ecdh.js
Created June 25, 2015 16:50
Node.js v0.12 ECDH Example
var ecdh = crypto.createECDH('secp256k1');
ecdh.generateKeys();
var publicKey = ecdh.getPublicKey(null, 'compressed');
var privateKey = ecdh.getPrivateKey(null, 'compressed');
console.log('Private1:', privateKey.length, privateKey.toString('hex'));
console.log('Public1: ', publicKey.length, publicKey.toString('hex'));
@moshest
moshest / ts-error.ts
Created March 29, 2020 14:30
Funval demo ts error
import { Schema, Optional, Or, Type } from 'funval';
const UserSchema = {
name: Optional(String),
status: Or('active' as 'active', 'suspended' as 'suspended'),
};
const validator = Schema(UserSchema);
let user: Type<typeof UserSchema>;
try {
@moshest
moshest / dynamic-lang.md
Last active February 29, 2020 15:26
A POC for Dynamic Syntax Language

Dynamic Syntax Language (POC)

I had an idea, creating a programming language with a dynamic syntax. Meaning, every programmer can extend the language easily and implement syntactic sugars fast.

Example Usage

import { createUseStyles } from 'react-jss';

// use native css styles with your code
@moshest
moshest / setup-mongodb.sh
Last active November 20, 2018 01:51
Setup Mongodb Server on Amazon EC2
#!/usr/bin/env bash
# usage: wget -N https://gist.githubusercontent.com/moshest/e4c73efc8d6a35971f6e/raw/setup-mongodb.sh && sh ./setup-mongodb.sh
set -e
# configs
read -e -p "Replica set name: " -i "rep1" replSet
read -e -p "Hostname: " -i $(curl -s http://169.254.169.254/latest/meta-data/public-hostname) hostname
read -e -p "Swap size: " -i "8G" swapsize
@moshest
moshest / medium.txt
Created April 23, 2018 07:56
Keyuno articles
Link: https://medium.com/@keyuno/constructing-universal-map-of-knowledge-7fcd03a084d9
Key Uno, https://keyuno.github.io/masterkey/
Aug 29, 2017
Constructing Universal Map Of Knowledge
By designing a system of economic incentives that will provide access to reliable information to anyone with an internet connection.
Structure:
The universal map of knowledge consists of two parts:
@moshest
moshest / outputs.txt
Last active April 12, 2018 09:22
Node.js Performance Comparison Between SHA-512 and SHA-256
# MacBook Pro (Mid 2015) - 2.5 GHz Intel Core i7
# Node.js v9.2.0
block size: 8192
hashing sha512 x 300000 times: 4447ms
hashing sha256 x 300000 times: 6105ms
difference: 27.158067158067155 %
block size: 4096
hashing sha512 x 300000 times: 2601ms
@moshest
moshest / install.sh
Last active January 17, 2018 17:22
AWS CodeDeploy with Node.js
#!/bin/bash
# usage: `curl --silent --location https://gist.githubusercontent.com/moshest/32b19e146bc5e1665708c885e535a631/raw/install.sh | bash -`
set -e
yum -y update
AWS_REGION=`curl http://169.254.169.254/latest/dynamic/instance-identity/document|grep region|awk -F\" '{print $4}'`
echo AWS Region: $AWS_REGION
# install CodeDeploy