Skip to content

Instantly share code, notes, and snippets.

cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Secret
metadata:
name: ssl
type: Opaque
data:
tls.crt: BASE64 ENDCODED CERTIFICATE CONTENT
tls.key: BASE64 ENCODED KEY CONTENT
ca.crt: BASE64 ENCODED ROOT CERTIFICATE CONTENT
cat <<EOF | kubectl apply -f -
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
kubernetes.io/tls-acme: "false"
nginx.ingress.kubernetes.io/configuration-snippet: |
add_header 'access-control-expose-headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Search-Id' always;
nginx.ingress.kubernetes.io/cors-allow-credentials: "false"
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
generation: 1
name: arc
spec:
selector:
@lakhansamani
lakhansamani / elasticsearch.sh
Last active December 12, 2019 06:19
Kubernetes configuration for creating deploying ElasticSearch using ECK
cat <<EOF | kubectl apply -f -
apiVersion: elasticsearch.k8s.elastic.co/v1beta1
kind: Elasticsearch
metadata:
name: elasticsearch
spec:
version: 7.4.2
nodeSets:
- name: masters
count: 1
@lakhansamani
lakhansamani / contentment.gitflow.md
Last active November 25, 2019 16:18
Git flow for contentment

Git flow

  1. Create feat/fix branches for each fix/enhancment/feature from develop branch

       git checkout develop
       git pull origin develop
       git checkout -b feat/add-teachers
    
  2. Commit message

@lakhansamani
lakhansamani / string-reducer.js
Last active November 1, 2019 11:32
A small babel plugin to convert string reduce into actual reduce function.
// test input
let strArr = ["hello", "world"];
strArr.reduce("+")
// babel tranform
export default function(babel) {
const { types: t } = babel;
return {
name: "string-reducer",
@lakhansamani
lakhansamani / Commands.sh
Created October 16, 2019 04:19 — forked from nrollr/Commands.sh
Install PHP and NGINX on Amazon Linux AMI
## Install NGINX
## when installing on Amazon Linux AMI, use:
$ sudo yum install nginx -y
## when installing on Amazon Linux 2 AMI, use
$ sudo amazon-linux-extras install nginx1.12 -y
## Install PHP and PHP-FPM
# for PHP version 7.1 use php71 and php71-fpm instead
$ sudo yum install php -y
$ sudo yum install php-fpm -y
const API = 'http://localhost:5000';
////////////////////////
// FilePreview.tsx
import React, { useState } from 'react';
import { Icon, Modal, notification } from 'antd';
interface IProps {
isLoading: boolean;
@lakhansamani
lakhansamani / docker.md
Last active June 17, 2020 17:08
Quick docker containers for local machine

Elasticsearch

Elasticsearch 7

  • docker run -d --name es7 -p 9700:9200 -p 9730:9300 -e "discovery.type=single-node" -e "http.host=0.0.0.0" -e "http.cors.enabled=true" -e "http.cors.allow-origin=*" -e "http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization" -e "http.cors.allow-credentials=true" -e "ES_JAVA_OPTS=-Xms512m -Xmx512m" elasticsearch:7.6.0

Elasticsearch 6

  • docker run -d --name es6 -p 9600:9200 -p 9630:9300 -e "discovery.type=single-node" -e "http.host=0.0.0.0" -e "http.cors.enabled=true" -e "http.cors.allow-origin=*" -e "http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization" -e "http.cors.allow-credentials=true" -e "ES_JAVA_OPTS=-Xms512m -Xmx512m" elasticsearch:6.7.0

Elasticsearch 5

  • `docker run -d --name es5 -p 9500:9200 -p 9530:9300 -e "discovery.type=single-node" -e "http.host=0.0.0.0" -e "http.cors.enabled=true" -e "http.cors.allow-origin=*" -e "http.cors.allow-headers=X-Requested-With,X-Auth-Tok

Setting up Apache tika with Python

Dependendices

  • Java 8
  • Python >= 2.7

Downloading and Setting up tika server

Manual download and setup