Skip to content

Instantly share code, notes, and snippets.

View niksrc's full-sized avatar
🏠
Working from home

Nikhil Srivastava niksrc

🏠
Working from home
View GitHub Profile
wget 'https://software-download.microsoft.com/pr/Win10_1903_V1_English_x64.iso?t=bc4db476-fb27-4104-8abf-d6a531010fba&e=1568366467&h=45b9e746dfb18e18be4c9dcecbb11570'

Keybase proof

I hereby claim:

  • I am niksrc on github.
  • I am niksrc (https://keybase.io/niksrc) on keybase.
  • I have a public key whose fingerprint is B8C0 4B37 A7EA B068 FDCB 5842 4680 24B4 75CF 59E1

To claim this, I am signing this object:

@niksrc
niksrc / aws-instances-allocation.sh
Created July 18, 2018 06:49
Get non reserved instances running in EC2
reserved=$(aws ec2 describe-reserved-instances | jq '.ReservedInstances | map(select(.State == "active")) | map({ (.InstanceType): .InstanceCount }) | map(to_entries) | add | group_by(.key) | map({key: .[0].key, value: map(.value) | add }) | from_entries')
running=$(aws ec2 describe-instances | jq '.Reservations | map(.Instances) | flatten | map(select(.State.Code == 16 and .InstanceLifecycle != "spot")) | map(.InstanceType) | group_by(.) | map({ (.[0]|tostring) : .|length }) | add')
echo $reserved, $running
@niksrc
niksrc / how-to-set-up-stress-free-ssl-on-os-x.md
Created February 5, 2018 07:11 — forked from jed/how-to-set-up-stress-free-ssl-on-os-x.md
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@niksrc
niksrc / infra-secret-management-overview.md
Created January 17, 2018 12:04 — forked from maxvt/infra-secret-management-overview.md
Infrastructure Secret Management Software Overview

Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.

This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.

There is a companion feature matrix of various tools. Comments are welcome in the same manner.

@niksrc
niksrc / API.md
Created January 24, 2017 10:05 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@niksrc
niksrc / latency.markdown
Created February 9, 2016 18:54 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@niksrc
niksrc / index.html
Created December 5, 2015 09:40 — forked from anonymous/index.html
Deals Hub // source https://jsbin.com/bitizu
<!DOCTYPE html>
<html data-ng-app="DealsHub">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Deals Hub</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href='https://fonts.googleapis.com/css?family=Lato:300' rel='stylesheet' type='text/css'>
<link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.2/normalize.min.css" rel="stylesheet" type="text/css" />
@niksrc
niksrc / gist:bdddac2c6d305d6e8f87
Last active August 29, 2015 14:23 — forked from dustismo/gist:6203329
Install leveldb
sudo apt-get install libsnappy-dev
wget https://github.com/google/leveldb/archive/master.zip
unzip master.zip
cd leveldb-master
make
sudo mv libleveldb.* /usr/local/lib
cd include
sudo cp -R leveldb /usr/local/include
sudo ldconfig
mkdir ~/local
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local