Skip to content

Instantly share code, notes, and snippets.

View swazza's full-sized avatar

Swarup Karavadi swazza

  • Stockholm, Sweden
  • 21:50 (UTC +01:00)
View GitHub Profile
[
{
"_id": "5eccff8f32b4791adbd70309",
"index": 0,
"guid": "6f170ad4-7cfa-4fe4-8f76-6c14488ce670",
"isActive": true,
"balance": "$3,781.81",
"picture": "http://placehold.it/32x32",
"age": 39,
"eyeColor": "blue",
prop_replace () {
target_file=${3}
echo 'replacing target file ' ${target_file}
sed -i -e "s|^$1=.*$|$1=$2|" ${target_file}
}
# Install the jq tool. This tool is needed to query values from the config.json
# file created by the tls-toolkit running in the client mode
apt-get update && apt-get install jq -y
sed -i -e 's|<property name="Authorizations File">./conf/authorizations.xml</property>|<property name="Authorizations File">./auth-conf/authorizations.xml</property>|' $${NIFI_AUTHZ_FILE}
sed -i -e 's|<property name="Users File">./conf/users.xml</property>|<property name="Users File">./auth-conf/users.xml</property>|' $${NIFI_AUTHZ_FILE}
const https = require('https');
const http = require('http');
const fs = require('fs');
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;
const allowedHosts = [];
function onHTTPRequest(req, res) {
const { headers, url } = req;
const { host } = headers;
# Run the tls-toolkit in client mode to generate the truststore and keystore
/opt/nifi/nifi-toolkit-current/bin/tls-toolkit.sh client -c nifi-ca-cs -t <token> --dn "CN=$(hostname -f), OU=NIFI"
# Use jq to extract the passwords form the config.json generated by the tls-toolkit
KEY_STORE_PASSWD=`jq -r '.keyStorePassword' ./config.json`
KEY_PASSWD=`jq -r '.keyPassword' ./config.json`
TRUST_STORE_PASSWD=`jq -r '.trustStorePassword' ./config.json`
mv ./keystore.jks conf/
mv ./truststore.jks conf/
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: nifi-ca
namespace: nifi
labels:
app: nifi-ca
spec:
# modify replicas according to your case
replicas: 1
<userGroupProvider>
<identifier>file-user-group-provider</identifier>
<class>org.apache.nifi.authorization.FileUserGroupProvider</class>
<property name="Users File">./auth-conf/users.xml</property>
<property name="Legacy Authorized Users File"></property>
<property name="Initial User Identity 0">{adminemail}</property>
<property name="Initial User Identity 3">CN=nifi-2.nifi-hs.nifi.svc.cluster.local, OU=NIFI</property>
<property name="Initial User Identity 2">CN=nifi-1.nifi-hs.nifi.svc.cluster.local, OU=NIFI</property>
<property name="Initial User Identity 1">CN=nifi-0.nifi-hs.nifi.svc.cluster.local, OU=NIFI</property>
</userGroupProvider>
@swazza
swazza / react-rmap.md
Last active June 28, 2017 11:01
Roadmap For React - Noob To Ninja

Basics

  • "Hello, World!" with create-react-app
  • React Component
  • Popular ES6+ features using in React Apps
    • Arrow Methods
    • Object Destructuring
    • Classes
    • Static fields
  • Communicating Between Components
  • Parent To Child using 'props'
@swazza
swazza / .js
Created May 11, 2017 01:39
Generators as Observables
function observable(observer) {
for(var i = 0; i <= 10; i++) {
observer.next(i)
}
observer.error()
observer.complete()
}
const observer = {
next(value) { console.log(`next -> ${value}`) },