Skip to content

Instantly share code, notes, and snippets.

View secretshardul's full-sized avatar

ss secretshardul

View GitHub Profile
@secretshardul
secretshardul / MerkleLog.sol
Created December 3, 2022 16:47
Merkle log
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
library MerkleLog {
// The merkle root of log values from 0.100 to 9.999 in X64 format
bytes32 constant root = 0x998add033af31411c96b8272b055b95b55d92f349c84111d5fac9e2cfcad7589;
function log10 (
/// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio
/// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may
/// ever return.
/// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96
/// @return tick The greatest tick for which the ratio is less than or equal to the input ratio
function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {
// second inequality must be < because the price can never reach the price at the max tick
require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');
uint256 ratio = uint256(sqrtPriceX96) << 32;
@secretshardul
secretshardul / shardnet-validator-setup.sh
Last active July 21, 2022 08:16
shardnet validator setup
# Install build dependencies and Rust
sudo apt install clang build-essential make
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# clone latest version of Nearcore
git clone https://github.com/near/nearcore
cd nearcore
git fetch origin --tags
git checkout 8448ad1eb
@secretshardul
secretshardul / near-validator-cli-setup.sh
Last active July 16, 2022 11:13
NEAR CLI and staking pool setup
# Update packages
sudo apt update && sudo apt upgrade -y
# Install nodejs
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install build-essential nodejs
PATH="$PATH"
# Install NEAR CLI
sudo npm i -g near-cli
@secretshardul
secretshardul / script.sh
Created April 6, 2021 14:11
Micmac Golem Boudha script
ls >> /golem/resource/extracted/files.txt
Tapioca MulScale "/golem/resource/extracted/IMG_[0-9]{4}.tif" 300 -1 ExpTxt=1
Apero /golem/resource/extracted/Apero-5.xml
MICMAC /golem/resource/extracted/Param-6-Ter.xml
@secretshardul
secretshardul / sawo-sdk-bug.html
Created January 29, 2021 13:37
The SDK is not accepting `secretKey` parameter. It should be accepted so authenticator can be displayed.
<html>
<head>
</head>
<body>
<h1>Sawo</h1>
<source>
<div id="sawo-container" style="height: 300px; width: 300px;"></div>
@secretshardul
secretshardul / .git-commit-template
Last active May 12, 2020 13:57 — forked from zakkak/.git-commit-template
This commit message template that helps you write great commit messages and enforce it across your team.
# [<tag>] (If applied, this commit will...) <subject> (Max 72 char)
# |<---- Preferably using up to 50 chars --->|<------------------->|
# Example:
# [feat] Implement automated commit messages
# (Optional) Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# (Optional) Provide links or keys to any relevant tickets, articles or other resources
# Example: Resolves #23
@secretshardul
secretshardul / .git-commit-template.txt
Created May 12, 2020 13:52 — forked from adeekshith/.git-commit-template.txt
This commit message template helps you write great commit messages and enforce it across teams.
# <type>: (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->|
# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
@secretshardul
secretshardul / README.md
Last active February 7, 2020 13:46
How to send SMS from Textlocal API using Postman and CURL. Here I have used POST method.
  1. HTTP specifications TextLocal API accepts input in application/x-www-form-urlencoded format.
POST /send/ HTTP/1.1
Host: api.textlocal.in
Content-Type: application/x-www-form-urlencoded
Accept: */*

apiKey=<your_API_key>&message=sent+by+me+from+textlocal+API&numbers=<phone_numbers_separated_by_commas>&test=true
@secretshardul
secretshardul / index.js
Created February 4, 2020 11:14
Lambda function reads a file from an S3 bucket. It converts it into a base64 encoded string and returns the value. API gateway converts this into binary and adds the appropriate header.
var AWS = require("aws-sdk");
var s3 = new AWS.S3();
exports.handler = (event, context, callback) => {
var params = {Bucket: 'myBucket', Key: 'myImg.png'};
s3.getObject(params, function(err, data) {
if (err) {
console.log(err, err.stack);
}
else{