Skip to content

Instantly share code, notes, and snippets.

Avatar

Mihai Tomescu matomesc

View GitHub Profile
@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
@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 / 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 / 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 / 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 / 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.
View rxjs_operators_by_example.md
@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 ubuntu-configure-sendmail-with-gmail
#!/bin/bash
HOST=$(hostname)
function install_postfix() {
echo | sudo debconf-set-selections <<__EOF
postfix postfix/root_address string
postfix postfix/rfc1035_violation boolean false
postfix postfix/mydomain_warning boolean
postfix postfix/mynetworks string 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
View Exploiting Lua 5.1 on 32-bit Windows.md

Exploiting Lua 5.1 on 32-bit Windows

The following Lua program generates a Lua bytecode program called ignore-unsigned-sga.fnt, which in turn loads a DLL from within an extremely locked down Lua 5.1 sandbox in a program called RelicCOH2.exe. The remainder of this document attempts to explain how this program works by a whirlwind tour of relevent bits of the Lua 5.1 virtual machine.

if string.dump(function()end):sub(1, 12) ~= "\27Lua\81\0\1\4\4\4\8\0" then
  error("This generator requires a 32-bit version of Lua 5.1")
end

local function outer()
  local magic -- In bytecode, the stack slot corresponding to this local is changed