Skip to content

Instantly share code, notes, and snippets.

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

Lakshman lakshmankashyap

🏠
Working from home
View GitHub Profile
@lakshmankashyap
lakshmankashyap / recover.md
Last active March 14, 2018 19:21
Recover Ethereum keystore using the private key and keystore password

/bin/node

// https://github.com/ethereumjs/ethereumjs-wallet
// -> npm install ethereumjs-wallet
var Wallet = require('ethereumjs-wallet');

var privateKey = '-> your private key here <-'; // in hex format
var keystorePassword = '-> your keystore password here <-';

var wallet = Wallet.fromPrivateKey(Buffer.from(privateKey, 'hex'));
@lakshmankashyap
lakshmankashyap / recover.js
Created March 9, 2018 11:31
Recover Ethereum keystore using the private key and keystore password
#!/bin/node
// https://github.com/ethereumjs/ethereumjs-wallet
// -> npm install ethereumjs-wallet
var Wallet = require('ethereumjs-wallet');
var privateKey = '-> your private key here <-'; // in hex format
var keystorePassword = '-> your keystore password here <-';
var wallet = Wallet.fromPrivateKey(Buffer.from(privateKey, 'hex'));
@lakshmankashyap
lakshmankashyap / gist:8d5eda3974613927b8e3df24929411ac
Created February 26, 2018 08:03 — forked from chad3814/gist:2924672
deleting array items in javascript with forEach() and splice()
// This is from my comment here: http://wolfram.kriesing.de/blog/index.php/2008/javascript-remove-element-from-array/comment-page-2#comment-466561
/*
* How to delete items from an Array in JavaScript, an exhaustive guide
*/
// DON'T use the delete operator, it leaves a hole in the array:
var arr = [4, 5, 6];
delete arr[1]; // arr now: [4, undefined, 6]
@lakshmankashyap
lakshmankashyap / inactivity.js
Created February 6, 2018 17:38 — forked from gerard-kanters/inactivity.js
Inactivity timeout javascript
<script type="text/javascript">
function idleTimer() {
var t;
//window.onload = resetTimer;
window.onmousemove = resetTimer; // catches mouse movements
window.onmousedown = resetTimer; // catches mouse movements
window.onclick = resetTimer; // catches mouse clicks
window.onscroll = resetTimer; // catches scrolling
window.onkeypress = resetTimer; //catches keyboard actions
@lakshmankashyap
lakshmankashyap / inactivity.js
Created February 6, 2018 17:38 — forked from gerard-kanters/inactivity.js
Inactivity timeout javascript
<script type="text/javascript">
function idleTimer() {
var t;
//window.onload = resetTimer;
window.onmousemove = resetTimer; // catches mouse movements
window.onmousedown = resetTimer; // catches mouse movements
window.onclick = resetTimer; // catches mouse clicks
window.onscroll = resetTimer; // catches scrolling
window.onkeypress = resetTimer; //catches keyboard actions
Security - the elephant in the room. Everyone agrees that it is very important but few takes it seriously. We at RisingStack want you to do it right - this is why we have put together this checklist to help you guide through the must have security checks before your application is enabled to thousands of users/customers.
Most of these items are general and applies to all languages and frameworks not just Node.js - however some of the tools presented are Node.js specific. You should also check our introductory Node.js security blogpost.
Configuration Management
Security HTTP Headers
There are some security-related HTTP headers that your site should set. These headers are: