Skip to content

Instantly share code, notes, and snippets.

Avatar

Nabil Redmann BananaAcid

View GitHub Profile
@BananaAcid
BananaAcid / .gitignore
Last active Mar 14, 2020
compress a folder with 7z using a gitignore list
View .gitignore
node_modules
.git
.gitignore
@BananaAcid
BananaAcid / web.config
Created Jun 21, 2019
reverse proxy to couchdb on IIS
View web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<conditions>
<!-- disable login ! only locally allowed: http://localhost:5984/_utils/#login -->
<add input="{PATH_INFO}" pattern="^(.*)/_utils/(.*)" negate="true" />
@BananaAcid
BananaAcid / readme.md
Last active Aug 5, 2019
Wrappler.io download
View readme.md
@BananaAcid
BananaAcid / web.config
Last active Jun 7, 2019
iisnode handling
View web.config
<!-- 1. install: https://github.com/Azure/iisnode/releases 2. add website in IIS, 3. drop this file into a node website -->
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
<iisnode
View gui.framework.ps1
# (c) Nabil Redmann 2019
# based on https://stackoverflow.com/a/52416973/1644202
function LoadXamlFile
{
Param
(
[Parameter(Mandatory=$true)] $xamlFile
)
View 0_promise_test.mjs
#!/bin/sh
':' //; exec "`command -v node`" "--experimental-modules" "--no-warnings" "$0" "$@"
import fsOrig from 'fs'; const fs = fsOrig.promises;
import path from 'path';
function delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
@BananaAcid
BananaAcid / _readme.md
Last active Aug 12, 2021
node js simple param parsing
View _readme.md

commandline parsing in nodejs

Parse commandline arguments (common formats) on osx/linux/windows:

    --param1             =>  argv.param1 = true
    --param2 "ab c"      =>  argv.param2 = 'ab c'
    --param3 abc         =>  argv.param3 = 'abc'
    -p4                  =>  argv.p4 = true
    -p4 val              =>  argv.p4 = 'val'
    -p4 "val 2"          =>  argv.p4 = 'val 2'
    /p5                  =>  argv.p5 = true
@BananaAcid
BananaAcid / index.php
Created Oct 29, 2018
simple basic auth for gateway index.php
View index.php
<?php
/*
in case you got a server config, that routes all calls through this index.php
will not protect files, except you check the header with the server and re route to this script for validation.
... used this on IIS server. Apache, Nginx, Lightttpd, ... have simple onboard means.
*/
// simple auth
@BananaAcid
BananaAcid / install-nodejs-docker.sh
Last active Oct 4, 2018
nvm nodejs and modules apt-get ubuntu for all users
View install-nodejs-docker.sh
# install
#
# $ curl -o- https://gist.githubusercontent.com/BananaAcid/93c319ada91c30ed904e9bc93d324a19/raw/install-nodejs-docker.sh | bash
#
# installing:
# 1. git,
# 2. nvm for all users centralized,
# 3. nodejs through nvm,
# 4. nodejs packages thorugh npm
#
@BananaAcid
BananaAcid / url-exists-head-es6.node.js
Last active Aug 31, 2018
url exists in node - awaitable async ES6 solution, doing a HEAD request
View url-exists-head-es6.node.js
//** https://stackoverflow.com/questions/26007187/node-js-check-if-a-remote-url-exists/51757188#51757188
// options for the http request
let options = {
host: 'google.de',
//port: 80, optional
//path: '/' optional
}