Skip to content

Instantly share code, notes, and snippets.

View nissshh's full-sized avatar
💭
I may be slow to respond.

Nishant Sonar nissshh

💭
I may be slow to respond.
View GitHub Profile
@nissshh
nissshh / user-data.yaml
Created January 6, 2022 18:00 — forked from jeffbrl/user-data.yaml
AWS CloudFormation UserData Example
# This example is from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-sub.html.
UserData:
Fn::Base64:
!Sub |
#!/bin/bash -xe
yum update -y aws-cfn-bootstrap
/opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource LaunchConfig --configsets wordpress_install --region ${AWS::Region}
/opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource WebServerGroup --region ${AWS::Region}
@nissshh
nissshh / redis_cheatsheet.bash
Created October 13, 2021 07:14 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@nissshh
nissshh / postgres_queries_and_commands.sql
Created March 26, 2021 16:47 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@nissshh
nissshh / pr.md
Created September 21, 2020 07:15 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

I am including some commands for GIT related tasks that can come handy
1. git pull upstream develop ==== pull from base/fork branch original from where we have forked to.
git pull origin develop ===== pull from same org (or forked) repo.
cherry-pick == pick specific checking in a branch. There is a dry run mode and a commit mode.
@nissshh
nissshh / MyList.java
Last active June 25, 2018 13:11
Reverse Linked list using recursion without any DS
package com.mc.examples;
import java.util.LinkedList;
import java.util.ListIterator;
public class MyList {
public static void main(String[] args) {
LinkedList<Integer> l = new LinkedList<>();
for (int i = 0; i < 100; i++) {
l.add(i);
Below are the validators
On Terminal 0 I started Validato 0,Rest API 0, settings-tp 0 and identity tp0
1.sudo sawtooth-validator -vv --bind network:tcp://10.34.14.1:8800 --bind component:tcp://10.34.14.1:4004 --peering dynamic --endpoint tcp://10.34.14.1:8800 --scheduler serial --network-auth challenge
2.settings-tp -C tcp://10.34.14.1:4004
3.identity-tp -C tcp://10.34.14.1:4004
4.sawtooth-rest-api -C tcp://10.34.14.1:4004 -B 10.34.14.1:8008
I also registered a valida user for settings as below for user dev.
$sawset proposal create sawtooth.identity.allowed_keys=02a8d5d019a596e979e073dedd559ab23e4982f35d79292e50b94e2aa8e2f5d626 --url http://10.34.14.1:8008
A very important command that i learnt was a git cherry-pick , that is usefulll in cases wher you want to move only a perticular commit from other branch
to your branch. In regular cases if you merge 2 branches all teh changes (from head) are merged to target.
e.g. git cherry-pick -n <commit>
-n option is important , as the command keeps the changes in your working files, if not given checkes in the change.
At times you may be gated to not checking some files due to dependency on reviewer or functiolnality not completely. Simply say , tha you have to share your changes
and at the same time you cannot chcking. ut you still want to share the change with the team . e.g. change in the bottomose layer like entties and and persistanc layes
One way is to create a new branch and ask other to switch , but this leads to nested merges later on. I found a simply way is to use a patch
I used it via Eclispse PATCH Team>Crat PAtch ... . This will ask you to create multiple patch files depending on your project and then thei patch file can be sahted wiuth the team to appy
locally. Voilla !!
So when thigs are checked in the patch can be removed. This is helpfull when you are mergin and you got issue, You can simply refert the patched files and lonce merge issue areresolved path again.
@nissshh
nissshh / Hibernat Data Modal
Created January 13, 2017 09:03
A typical data model for sales
Hibernate Sample
Customer
Name
Address
PaymentId
Payment
PaymentId
PaymentType
Order
OrderNumber