Skip to content

Instantly share code, notes, and snippets.

View moshest's full-sized avatar

Moshe Simantov moshest

View GitHub Profile
@moshest
moshest / ts-error.ts
Created March 29, 2020 14:30
Funval demo ts error
View ts-error.ts
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
View dynamic-lang.md

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 / medium.txt
Created April 23, 2018 07:56
Keyuno articles
View medium.txt
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
View outputs.txt
# 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 / alac2aac.bat
Created May 21, 2017 07:54
Convert alac to aac with ffmpeg
View alac2aac.bat
if not exist "output" mkdir output
for /r path %%var in (*.m4a) do ffmpeg -i %%var -c:a libfdk_aac -b:a 320k output\%%var.m4a
@moshest
moshest / split.bat
Created April 23, 2017 08:43
Split S1 .Mov files to folders
View split.bat
@echo off
set found=0
setlocal enabledelayedexpansion
for /L %%a in (start,1,9999) do (
set "num=%%a"
set "num=!num:~-4!"
if exist "ZCAM!num!_*.MOV" (
set found=1
echo "Create and move files to folder '%%num'"
@moshest
moshest / ffmpeg-cheatsheet.md
Created April 6, 2017 08:56 — forked from nickkraakman/ffmpeg-cheatsheet.md
FFmpeg cheat sheet for 360 video
View ffmpeg-cheatsheet.md

FFmpeg Cheat Sheet for 360º video

Brought to you by Headjack

 
FFmpeg is one of the most powerful tools for video transcoding and manipulation, but it's fairly complex and confusing to use. That's why I decided to create this cheat sheet which shows some of the most often used commands.

 
Let's start with some basics:

  • ffmpeg calls the FFmpeg application in the command line window, could also be the full path to the FFmpeg binary or .exe file
@moshest
moshest / quine.js
Last active September 7, 2017 07:07
A JavaScript function that reproduce itself as a Quine program
View quine.js
/**
* A JavaScript function that reproduce itself as a Quine program.
* Copyright (c) 2017 Moshe Simantov
*/
const assert = require('assert');
const quine = (function () {
var f = '(function () {%0A var f = %27@%27;%0A%0A return eval(unescape(f).replace(/@/, f));%0A})';
@moshest
moshest / es6-methods.js
Created September 10, 2016 21:43
ES6 methods implementation
View es6-methods.js
class Foo {
test() {
return 'Foo';
}
}
class Bar extends Foo {
test() {
return `${super.test()}Bar`;
}
@moshest
moshest / install.sh
Last active January 17, 2018 17:22
AWS CodeDeploy with Node.js
View install.sh
#!/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