Skip to content

Instantly share code, notes, and snippets.

View hiddentao's full-sized avatar
🌱

Ramesh Nair hiddentao

🌱
View GitHub Profile
@hiddentao
hiddentao / instructions.md
Last active July 21, 2020 07:27
Securing your Elrond validator + Netdata service behind nginx with self-signed SSL certificate on Ubuntu

Securing your Elrond validator + Netdata service behind nginx with self-signed SSL certificate on Ubuntu

Doing the following will ensure access to your node server is protected behind the firewall with the following URLs available:

  • https://<server ip>/node/* - you should see JSON output showing node stats (replace * with status, statistics, etc, see full list)
  • https://<server ip>/netdata - you will be prompted for the username and password you setup below, following which you should see your netdata dashboard

How to do it

Setup the firewall:

@hiddentao
hiddentao / docker-cheatsheat.md
Created July 7, 2020 16:07
Docker CLI cheatsheat (OS X)

Other docker commands

To delete the container:

docker rm --force <container name>

To delete the image:

@hiddentao
hiddentao / script.sql
Last active June 14, 2020 20:50
Create read-only user for specific Postgres db
create user user_name with encrypted password '...';
grant connect on database "db-name" TO user_name;
grant usage on schema public to user_name;
grant select on all tables in schema public to user_name;
alter default privileges in schema public grant select on tables to user_name;
@hiddentao
hiddentao / RoleBasedAcl.sol
Last active March 10, 2020 03:27
Ethereum solidity contract for role-based access control
pragma solidity ^0.4.10;
contract RoleBasedAcl {
address creator;
mapping(address => mapping(string => bool)) roles;
function RoleBasedAcl () {
creator = msg.sender;
}
@hiddentao
hiddentao / gist:7300694
Last active January 22, 2019 05:04
An improvement on the angular.module() API, making it easier to split up modules into multiple files without having to worry about only registering them once.
/**
* Workaround to make defining and retrieving angular modules easier and more intuitive.
*/
(function(angular) {
var origMethod = angular.module;
var alreadyRegistered = {};
/**
@hiddentao
hiddentao / gist:5946053
Last active November 13, 2018 18:18
Generate overridable getters and setters in Javascript
// see blog post: http://www.hiddentao.com/archives/2013/07/08/generate-overridable-getters-and-setters-in-javascript/
Function.prototype.generateProperty = function(name, options) {
// internal member variable name
var privateName = '__' + name;
options = options || {};
options.get = ('undefined' === typeof options.get ? true : options.get );
options.set = ('undefined' === typeof options.set ? true : options.set );
// pre-initialise the internal variable?
Verifying my identity on Peepeth.com 0xb1b6e377aa6ec6928a1d499ae58483b2b99658ec
@hiddentao
hiddentao / JustGive.sol
Created June 13, 2017 15:38
A crowd-funded donation wallet with a minimum cap. All ETH is returned to contributors if minimum cap not reached. All funding passed onto payee. Multiple authorizers allowed.
pragma solidity ^0.4.10;
contract SimpleAccessControl {
address public creator;
mapping authorized(address => bool);
function AccessControl () {
creator = msg.sender;
}
@hiddentao
hiddentao / LinkedInPYMKBulkInvite.js
Last active February 14, 2017 10:44
Linked-In Auto-send all People You May Know invites
/*
For use on: "My Network" page
This will first load full list of invite suggestions by auto-scrolling to bottom of page.
Once no more suggestions are left to load it will auto-connect to all by clicking all
Connect buttons (with 100ms interval between each click).
How to run: Run the below code in your browser's Javascript console (see
Developer Tools in chrome). DO NOT close or change the browser tab whilst this is running.
'use strict';
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constr