Skip to content

Instantly share code, notes, and snippets.

View Amit0617's full-sized avatar
🏠
Working from home

AMIT KUMAR MISHRA Amit0617

🏠
Working from home
View GitHub Profile
@Amit0617
Amit0617 / patch.md
Created October 15, 2024 08:02
create and apply patch (personal preferred way)
git format-patch -k --stdout

where -k is number of commits you want to create patch for from the latest situation. --stdout allows to see the merged diff of all these commits, hence preferred to check before creating patches. Now when you are sure, create patch files using

git format-patch -k

if k is 3, it will create 3 patch files for 3 past commits.

@Amit0617
Amit0617 / figma.md
Last active April 28, 2023 07:35
Hitchiker's guide to little unethical design who don't take pride into it.
  1. Search for related terms according to your design needs on dribble.
  2. Download all images which are relevant to your websites.
  3. Go to Figma and import all those images.
  4. Use segment out all things plugin to cut out everything as a separate asset.
  5. Choose which you require and add into your assets library.
  6. Now use those assets on your website.
  7. Decide a color pallete(ask AI to decide for you according to your website subject matter)
  8. Adapting design around one single theme is what you are supposed to do as a human.
@Amit0617
Amit0617 / Solidity
Last active April 28, 2023 06:54
Vscode-profile for solidity auditors
{"name":"Solidity","settings":"{\"settings\":\"{\\r\\n \\\"workbench.startupEditor\\\": \\\"welcomePage\\\",\\r\\n \\\"workbench.colorTheme\\\": \\\"Solarized Light\\\",\\r\\n \\\"workbench.editorAssociations\\\": [\\r\\n {\\r\\n \\\"viewType\\\": \\\"jupyter.notebook.ipynb\\\",\\r\\n \\\"filenamePattern\\\": \\\"*.ipynb\\\"\\r\\n }\\r\\n ],\\r\\n\\t\\\"editor.inlineSuggest.enabled\\\": true,\\r\\n \\\"files.autoSave\\\": \\\"onFocusChange\\\",\\r\\n \\\"editor.wordWrap\\\": \\\"on\\\",\\r\\n \\\"solidity.telemetry\\\": false\\r\\n}\"}","extensions":"[{\"identifier\":{\"id\":\"github.copilot\",\"uuid\":\"23c4aeee-f844-43cd-b53e-1113e483f1a6\"},\"displayName\":\"GitHub Copilot\"},{\"identifier\":{\"id\":\"jebbs.plantuml\",\"uuid\":\"d95cb424-7a5a-4e08-9698-107d6fd590cf\"},\"displayName\":\"PlantUML\"},{\"identifier\":{\"id\":\"juanblanco.solidity\",\"uuid\":\"25baab03-fe9a-40c7-b683-55c9a0a92480\"}},{\"identifier\":{\"id\":\"nomicfoundation.hardhat-solid
@Amit0617
Amit0617 / gcloud_ssh_through_terminal.txt
Last active September 3, 2022 15:55
How to ssh into google cloud shell?
For first time setup:-
gcloud auth login - To login into your google account
gcloud config set project PROJECT_ID
gcloud cloud-shell ssh --authorize-session
@Amit0617
Amit0617 / Why Arch?.md
Last active September 1, 2022 12:46
Convince me Why should I use arch?
  • If you have HDD, there gonna be a drastic difference in boot time.
$ systemd-analyze

Startup finished in 4.026s (kernel) + 47.655s (userspace) = 51.681s
graphical.target reached after 47.654s in userspace.

47 seconds might sound painful but that was around 2 minutes and 5-15 seconds in ubuntu and 10 minutes in Windows :)

  • For some reason, bluetooth never worked for me on ubuntu
@Amit0617
Amit0617 / squash.md
Created May 17, 2022 05:18
Squash multiple commits from commit history and make them one single commit
git rebase -i HEAD~2    #assumed last two commits need to be squashed

Similarly HEAD~3 for squashing last three and so on As a result vi or your any other text editor opens up top two lines(because we are squashing two commits) will be

pick [commit-sha] [commit-message]
pick [commit-sha] [commit-message] 

There will be more lines below them but all would be commented

@Amit0617
Amit0617 / HelloWorld.sol
Created April 23, 2022 17:25
Store a number and retreive its value
//SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
contract HelloWorld {
// Declaring a global variable that stores the number
uint myNumber;
/** @dev Store a given number into a variable
@Amit0617
Amit0617 / RestrictedTimeBallot.sol
Created April 23, 2022 16:08
Restrict time for voting to 5 mins
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title Ballot
* @dev Implements voting process along with vote delegation
*/
contract Ballot {
@Amit0617
Amit0617 / push_one_commit_only_with_one_pull_request.md
Last active June 4, 2023 16:43
Create separate pull request for every commit using simple example steps

One simple thing will be to before creating changes to file for next commit in separate pull request, checkout new branch tracking upstream repository branch against which you want to create your pull request.

But let say you have alreay committed the changes into the branch which might have already unaprroved pull requests. In thaaat case you have to do it little bit new way actually you have to cherry-pick the commit and put on a new branch. Then pull request against that other repository will be automatically creating new pull request against same original branch of that repository. So how do we do that? first you will need commit hash of that commit which you want to put on top of new branch. To get commit hash of that particular commmit do git log in the branch where you commited the required changes. There you will see the hash, commit message, timings and other info which will help you identify the required commit. After copying that hash(long ascii string - sha1) you can quit using q