Skip to content

Instantly share code, notes, and snippets.

Avatar

Mihai Tomescu matomesc

View GitHub Profile
@matomesc
matomesc / reqparser.py
Created Nov 13, 2013
flask-restful NestedRequestParser
View reqparser.py
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 Feb 9, 2012
Vending machine DFA transitions
View vending.js
// 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 Mar 27, 2017
Ionic 2: Run live-reload server over ssl
View live-reload.ts
// 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')),
});
View rxjs_operators_by_example.md
@matomesc
matomesc / firebase-toggle-fold.js
Last active May 11, 2017
Folds/unfolds all Firebase rules that are direct children of the "rules" node in the rules editor
View firebase-toggle-fold.js
// 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 Jun 21, 2017 — forked from 9to5IT/Script_Template.ps1
PowerShell: Script Template
View Script_Template.ps1
#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 Nov 18, 2018 — forked from braian87b/dumb-ap-wired-link.sh
How to setup a Dumb AP, Wired backbone for OpenWRT / LEDE
View dumb-ap-wired-link.sh
@matomesc
matomesc / Caddyfile
Created Aug 8, 2019 — forked from Ocramius/Caddyfile
Example docker + docker-compose + caddy + traefik setup that routes to multiple apps from one exposed HTTP port
View Caddyfile
:80 {
root /serve
}
@matomesc
matomesc / getmus.ps1
Created Sep 20, 2019 — forked from milleniumbug/getmus.ps1
download video from YouTube, extract music and normalize volume
View getmus.ps1
param(
[string]$url
)
youtube-dl `
$url `
--quiet `
--extract-audio `
--audio-format mp3 `
--audio-quality 3 `
@matomesc
matomesc / @sinclair+typebox+0.10.1.patch
Created Jun 9, 2020
Add support for larger unions to @sinclair/typebox
View @sinclair+typebox+0.10.1.patch
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