Skip to content

Instantly share code, notes, and snippets.

View Babitabisht's full-sized avatar

Babita Bisht Babitabisht

  • New Delhi
View GitHub Profile
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/EnumerableSet.sol";
import "../utils/Address.sol";
import "../utils/Context.sol";
/**
* @dev Contract module that allows children to implement role-based access
pragma solidity ^0.6.0;
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.4.0/contracts/token/ERC721/ERC721.sol";
contract InstNFT is ERC721("NFT-ONE", "NFTONE") {
address public owner;
@Babitabisht
Babitabisht / postgres cheatsheet.md
Last active September 8, 2021 08:24 — forked from apolloclark/postgres cheatsheet.md
postgres cheatsheet

Postgres Cheatsheet

sudo su postgres

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/

USE record_company;
CREATE TABLE test (
test_column int
);


ALTER TABLE test  
ADD anothet_column varchar(255);

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@Babitabisht
Babitabisht / Algorand.md
Created June 1, 2021 13:47
Algorand cheat sheet

#Multisignature Accounts

Create a multisig account by listing all of the accounts in the multisig and specifying the threshold number of accounts to sign with the -T flag
$ goal account multisig new <my-account1> <my-account2> <my-account3> etc… -T 2    

Create an unsigned transaction and write to file
$ goal clerk send --from <my-multisig-account>  --to AZLR2XP4O2WFHLX6TX7AZVY23HLVLG3K5K3FRIKIYDOYN6ISIF54SA4RNY --fee=1000 --amount=1000000 --out="unsigned.txn"

Sign by the required number of accounts to meet the threshold. 

Scaling your API with rate limiters

The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.

In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.

Request rate limiter

This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.

db.getCollection('charging').
aggregate([

	{
		$match: {
			userID: {
				$in: ["5fe8711ba2850f540546a728", "607ea662b256fc6abffb8fb8"]
			}
 }
@Babitabisht
Babitabisht / node_nginx_ssl.md
Created February 10, 2021 08:00 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user