Skip to content

Instantly share code, notes, and snippets.

View akrisiun's full-sized avatar

Andrius K akrisiun

View GitHub Profile
@akrisiun
akrisiun / gist:7440d84138c91ca23d7a33921053659f
Last active December 1, 2023 20:49 — forked from nikhilgeo/gist:911b76faf3e965143128a7ccb74772c9
Create CA and self-signed cert X.509 v3

1 Create CA

1.1 Create keys

openssl genrsa -out rootCA_key.key 2048. 
	-des3 algorithm to encrypt the key and will require you to enter a password in order for the key file to be created.
1.2 Create Root CA cert with constraint CA = true. 
openssl req -x509 -new -nodes -key rootCA_key.key -sha256  -days 1024  -out rootCA_crt.pem \ 
 -extensions v3_ca -reqexts v3_req -config /usr/local/etc/openssl/openssl.cnf
@akrisiun
akrisiun / self-signed-certificate-with-custom-ca.md
Created July 26, 2020 13:03 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@akrisiun
akrisiun / nodeapp.sh
Created May 25, 2020 11:24 — forked from lowol/nodeapp.sh
init.d script for node.js
#!/bin/bash
#
# nodejs - Startup script for node.js server
# /etc/init.d/app1
#
# chkconfig: 35 99 99
# description: Node.js node /apps/app1/server.js
rootdir="/var/www/apps/app1"
server="$rootdir/server.js"
@akrisiun
akrisiun / Install_gitflow_on_Windows.md
Created February 17, 2020 12:56 — forked from ilyar/Install_gitflow_on_Windows.md
Install gitflow on Windows

Install gitflow on Windows

Download and install Git from MSysGit or Git SCM. Download and install getopt.exe from the util-linux package into C:\Program Files\Git\bin. (Only getopt.exe, the others util-linux files are not used). Also install libintl3.dll and libiconv2.dll from the Dependencies packages (libintl and libiconv), into the same directory.

Suppose that Git is installed in the folder c:\bin\git and GnuWin32 in the folder c:\bin\GnuWin32.

Clone the git-flow sources from GitHub:

$ git clone --recursive https://github.com/nvie/gitflow.git
@akrisiun
akrisiun / tips_lsof.sh
Last active January 24, 2023 18:00 — forked from tianchaijz/tips_lsof.sh
Shell command lsof : see open files and ports; Selection is OR by default, use -a for AND; Tested on OSX
# filter LISTEN - faster variant
lsof -anP -i4 -sTCP:LISTEN
# exclude UDP
lsof -anP -i4 -sTCP:LISTEN | grep TCP
# lsof with ports sort:
lsof -anP -i4 -sTCP:LISTEN | grep -v UDP | awk {'printf("%18s %-12s %8s %s %s %s\n", $9,$1,$2,$4,$3,$10)'} | sort -u
# docker-ps
@akrisiun
akrisiun / .bashrc
Last active October 24, 2019 01:38 — forked from jirutka/-README.md
How to use terminal on Windows and don’t go crazy…
#
# Bash settings
#
# Append to the history file instead of overwrite it
shopt -s histappend
# Append the previous command to history each time a prompt is shown
PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
@akrisiun
akrisiun / k8s-services.yaml
Created October 3, 2019 17:48 — forked from dmaze/k8s-services.yaml
Very minimal Kubernetes NodePort/LoadBalancer services
---
apiVersion: v1
kind: ConfigMap
metadata: {name: content}
data:
index.html: '<html><body><h1>Hello world</h1></body></html>'
---
apiVersion: apps/v1beta2
kind: Deployment
metadata: {name: lb}
@akrisiun
akrisiun / Indexes Usage Stats.sql
Created September 16, 2019 05:36 — forked from Velniai/Indexes Usage Stats.sql
[Index Maintainance] #sql #index #dmv
DECLARE @TableName VARCHAR(20) = NULL
SELECT TableName = OBJECT_NAME(S.object_id),
IndexName = I.name,
UserSeeks = S.user_seeks,
UserScans = S.user_scans,
UserLookups = S.user_lookups,
UserUpdates = S.user_updates ,
IsPrimaryKey = i.is_primary_key
FROM sys.dm_db_index_usage_stats S
// server.js
// https://medium.com/better-programming/demystifying-reacts-server-side-render-de335d408fe4
import express from "express";
import path from "path";
import React from "react";
import { renderToString } from "react-dom/server";
import Layout from "./components/Layout";
// https://medium.com/homeaway-tech-blog/profiling-react-server-side-rendering-to-free-the-node-js-event-loop-7f0fe455a901
const ReactDOMServer = require('react-dom/server');
const render = (reactComponent) => {
return new Promise((resolve, reject) => {
const body = [];
const bodyStream = ReactDOMServer.renderToNodeStream(reactComponent);
bodyStream.on('data', (chunk) => {
body.push(chunk.toString());
});