Skip to content

Instantly share code, notes, and snippets.

View BananaAcid's full-sized avatar

Nabil Redmann BananaAcid

View GitHub Profile
@BananaAcid
BananaAcid / install-nodejs-docker.sh
Last active October 4, 2018 00:43
nvm nodejs and modules apt-get ubuntu for all users
# 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 / index.php
Created October 29, 2018 02:23
simple basic auth for gateway 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 / _readme.md
Last active August 12, 2021 19:48
node js simple param parsing

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 =&gt; argv.p5 = true
#!/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));
}
# (c) Nabil Redmann 2019
# based on https://stackoverflow.com/a/52416973/1644202
function LoadXamlFile
{
Param
(
[Parameter(Mandatory=$true)] $xamlFile
)
@BananaAcid
BananaAcid / web.config
Last active June 7, 2019 22:51
iisnode handling
<!-- 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
@BananaAcid
BananaAcid / readme.md
Last active August 5, 2019 09:49
Wrappler.io download
@BananaAcid
BananaAcid / web.config
Created June 21, 2019 01:04
reverse proxy to couchdb on IIS
<?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 / .gitignore
Last active March 14, 2020 00:19
compress a folder with 7z using a gitignore list
node_modules
.git
.gitignore
@BananaAcid
BananaAcid / readme.md
Last active July 18, 2019 09:58
payment services