Skip to content

Instantly share code, notes, and snippets.

View vyasriday's full-sized avatar
:octocat:
Focusing

Hridayesh Sharma vyasriday

:octocat:
Focusing
View GitHub Profile
@vyasriday
vyasriday / server.go
Created December 24, 2020 07:24 — forked from viveksyngh/server.go
Http Response in go
package main
import (
"fmt"
"net/http"
"encoding/json"
"html/template"
)
type User struct {
@vyasriday
vyasriday / git-checkout-prev-iteration.md
Created November 21, 2020 14:42
Command to revert a specific file to a specifc commit

to see all the commits

git log --oneline

checkout specific file revision from a specific commit

git checkout commit-hash filename
$ git remote rm origin
$ git remote add origin git@github.com:aplikacjainfo/proj1.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
const button = document.createElement('button');
button.id = "buttons";
button.type = "button";
button.addEventListener('click', clickHandler)
@vyasriday
vyasriday / react list.jsx
Created July 28, 2020 06:15
code to render list in React
const items = [
{
id: 1,
content: 'This is first Item'
},
{
id: 2,
content: 'This is first Item'
},
{
@vyasriday
vyasriday / randomNumberInGo.md
Last active May 26, 2020 11:19
Generating a random number in go using rand and time package
import  (
  "math/rand"
  "time"
)

func main() {
  // NewSource takes int64 value which is returned by time.Now().UnixNano()
  source := rand.NewSource(time.Now().UnixNano())
 r := rand.New(source)
@vyasriday
vyasriday / config
Created April 26, 2020 05:09 — forked from vrillusions/config
Example of a `~/.ssh/config` file which makes it easier to login to different servers
# ssh(1) obtains configuration data from the following sources in the following order:
#
# 1. command-line options
# 2. user's configuration file (~/.ssh/config)
# 3. system-wide configuration file (/etc/ssh/ssh_config)
#
# For each parameter, the first obtained value will be used. The configuration files contain sections separated
# by “Host” specifications, and that section is only applied for hosts that match one of the patterns given in the
# specification. The matched host name is the one given on the command line.
#
@vyasriday
vyasriday / multiple_ssh_setting.md
Created April 26, 2020 04:22 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@vyasriday
vyasriday / git-local-config.md
Last active April 25, 2020 11:53
how to set up git config for a repository

Set up git configuration

  1. Set up for each repository locally
$ git config --local user.email "email"
$ git config --local user.name "name"
  1. Set up global configuration