Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View matomesc's full-sized avatar

Mihai Tomescu matomesc

View GitHub Profile
@matomesc
matomesc / reqparser.py
Created November 13, 2013 04:34
flask-restful NestedRequestParser
from flask import request
from flask.ext.restful.reqparse import Argument, RequestParser
class NestedArgument(Argument):
def __init__(self, name, **kwargs):
pieces = name.split('.')
self.full_name = name
@matomesc
matomesc / vending.js
Created February 9, 2012 19:16
Vending machine DFA transitions
// usage: node vending.js > transitions
var coins = [5, 10, 25, 100];
var _sum = 125;
var validTransitions = [];
coins.forEach(function (c) { check(0, c); })
function check(sum, coin, transitions) {
transitions = transitions || [];
var newSum = sum + coin;
@matomesc
matomesc / live-reload.ts
Created March 27, 2017 16:32
Ionic 2: Run live-reload server over ssl
// Open locally https://github.com/driftyco/ionic-app-scripts/blob/master/src/dev-server/live-reload.ts
// and add the following options when creating the tinylr server (around line 10):
const liveReloadServer = tinylr({
key: fs.readFileSync(path.join(process.cwd(), 'proxy/server.key')),
cert: fs.readFileSync(path.join(process.cwd(), 'proxy/server.crt')),
});
@matomesc
matomesc / rxjs_operators_by_example.md
Created March 30, 2017 23:24 — forked from btroncone/rxjs_operators_by_example.md
RxJS 5 Operators By Example
@matomesc
matomesc / firebase-toggle-fold.js
Last active May 11, 2017 17:19
Folds/unfolds all Firebase rules that are direct children of the "rules" node in the rules editor
// Sometimes the rules editor lags when many rules are expanded.
// This snippet collapses all the rules that are direct children of the root "rules" node.
// Rules editor can be found at: https://console.firebase.google.com/project/{PROJECT_ID}/database/rules.
// Get CodeMirror instance
const editor = $('.CodeMirror')[0].CodeMirror;
// Find direct children of "rules" node and fold them.
editor.eachLine((l) => {
// Perhaps a better way is to check the parent of `l` to handle different indentations.
@matomesc
matomesc / Script_Template.ps1
Created June 21, 2017 18:18 — forked from 9to5IT/Script_Template.ps1
PowerShell: Script Template
#requires -version 2
<#
.SYNOPSIS
<Overview of script>
.DESCRIPTION
<Brief description of script>
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
@matomesc
matomesc / dumb-ap-wired-link.sh
Created November 18, 2018 19:59 — forked from braian87b/dumb-ap-wired-link.sh
How to setup a Dumb AP, Wired backbone for OpenWRT / LEDE
@matomesc
matomesc / Caddyfile
Created August 8, 2019 00:14 — forked from Ocramius/Caddyfile
Example docker + docker-compose + caddy + traefik setup that routes to multiple apps from one exposed HTTP port
:80 {
root /serve
}
@matomesc
matomesc / getmus.ps1
Created September 20, 2019 17:42 — forked from milleniumbug/getmus.ps1
download video from YouTube, extract music and normalize volume
param(
[string]$url
)
youtube-dl `
$url `
--quiet `
--extract-audio `
--audio-format mp3 `
--audio-quality 3 `
@matomesc
matomesc / @sinclair+typebox+0.10.1.patch
Created June 9, 2020 23:18
Add support for larger unions to @sinclair/typebox
diff --git a/node_modules/@sinclair/typebox/typebox.d.ts b/node_modules/@sinclair/typebox/typebox.d.ts
index 5c4b239..b405558 100644
--- a/node_modules/@sinclair/typebox/typebox.d.ts
+++ b/node_modules/@sinclair/typebox/typebox.d.ts
@@ -119,6 +119,42 @@ export declare type TIntersect1<T0 extends TSchema> = {
allOf: [T0];
} & UserDefinedOptions;
export declare type TIntersect = TIntersect8<TSchema, TSchema, TSchema, TSchema, TSchema, TSchema, TSchema, TSchema> | TIntersect7<TSchema, TSchema, TSchema, TSchema, TSchema, TSchema, TSchema> | TIntersect6<TSchema, TSchema, TSchema, TSchema, TSchema, TSchema> | TIntersect5<TSchema, TSchema, TSchema, TSchema, TSchema> | TIntersect4<TSchema, TSchema, TSchema, TSchema> | TIntersect3<TSchema, TSchema, TSchema> | TIntersect2<TSchema, TSchema> | TIntersect1<TSchema>;
+export declare type TUnion9<T0 extends TSchema, T1 extends TSchema, T2 extends TSchema, T3 extends TSchema, T4 extends TSchema, T5 extends TSchema, T6 extends TSchema, T7 extends TSchema, T8 extends TS