Skip to content

Instantly share code, notes, and snippets.

View tangoabcdelta's full-sized avatar

tangoabcdelta

View GitHub Profile
# create a self signed certificate for localhost
openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
openssl rsa -passin pass:x -in server.pass.key -out server.key
# writing RSA key
rm server.pass.key
openssl req -new -key server.key -out server.csr
# Country Name (2 letter code) [AU]:IN
# State or Province Name (full name) [Some-State]:Karnataka
@tangoabcdelta
tangoabcdelta / spdy.http2.js
Created April 16, 2022 14:44
determine if spdy or http2 was used to fetch website
window.performance.getEntriesByType("resource").filter(p => 'nextHopProtocol' in p)[0].nextHopProtocol // 'h2'
// deprecated
// https://chromestatus.com/feature/5637885046816768
window.chrome.loadTimes().wasFetchedViaSpdy; // true
window.chrome.loadTimes().npnNegotiatedProtocol; // 'h2'
window.chrome.loadTimes().connectionInfo; // 'h2'
@tangoabcdelta
tangoabcdelta / browser.zoom.detect.js
Created May 11, 2021 17:52
Detect-zoom - Cross Browser Zoom and Pixel Ratio Detector
/* Detect-zoom
* -----------
*https://codepen.io/reinis/pen/RooGOE
* Cross Browser Zoom and Pixel Ratio Detector
* Version 1.0.4 | Apr 1 2013
* dual-licensed under the WTFPL and MIT license
* Maintained by https://github/tombigel
* Original developer https://github.com/yonran
*/
@tangoabcdelta
tangoabcdelta / guess the output.md
Created March 16, 2021 20:22
guess the output questions
console.log(
  (x = {
    a: 10,
    b: () => this.a,
    c: function() {
      return this.a;
    },
  }) && x.b(),
 x.c(),
@tangoabcdelta
tangoabcdelta / Generating a new SSH key and adding it to the ssh-agent.md
Created March 6, 2021 14:14
Generating a new SSH key and adding it to the ssh-agent

Generating a new SSH key and adding it to the ssh-agent

  • Check for existing SSH keys
  • Generate a new SSH key to use for authentication
  • Add it to the ssh-agent.
  • If you don't already have an SSH key, you must generate a new SSH key. If you're unsure whether you already have an SSH key, check for existing keys.
  • If you don't want to reenter your passphrase every time you use your SSH key, you can add your key to the SSH agent, which manages your SSH keys and remembers your passphrase.

Generating a new SSH key

@tangoabcdelta
tangoabcdelta / generate zip archive of a git repository ignoring the files listed in `.gitignore` instructions.md
Created February 22, 2021 07:57
Generate zip archive of a git repository ignoring the files listed in `.gitignore`:

I have a git repo which compiles into a dist folder and generates a bunch binaries (executables). The binaries and dist folders are .gitignore-ed and hence, are not included in the repo. But I want to distribute a source + binaries snapshot zipfile. I want them to contain:

a) all the sources b) all the binaries c) the dist folder (so that they can tweak it) d) not the .git/ directory, not the hidden files like .cache or node_modules/ etc.

@tangoabcdelta
tangoabcdelta / How to Reset Forgotten Password in Linux.md
Last active February 8, 2021 09:09
How to Reset Forgotten Password in Linux

How to Reset Forgotten Password in Linux

  • While your computer is booting, press F8 key (in case boot menu doesn't appear)
  • From the boot menu select the "recovery mode" option and boot into recovery mode.
  • Select the option 'Drop to root shell prompt'
  • Type the following command to change the password: passwd username
    • Example:
      • passwd bigfatsoftware
  • passwd tangoabcdelta
@tangoabcdelta
tangoabcdelta / html.instead.of.ejs.instructions.md
Created February 7, 2021 13:47
keep the file extension of ejs file as .html, While developing an expressjs app using ejs templating engine you may want to use keep the extension as `*.html` instead of `*.ejs` e.g. `home.html` instead of using home.ejs. Main reason for using html is generally to use more effective code hint, formatting and syntax highlighting without adding an…

keep the file extension of ejs file as .html

  • While developing an expressjs app using ejs templating engine you may want to use keep the extension as *.html instead of *.ejs
  • e.g. home.html instead of using home.ejs.
  • Main reason for using html is generally to use more effective code hint, formatting and syntax highlighting without adding any extra settings. To accomplish it, you can perform any of the following:
1
@tangoabcdelta
tangoabcdelta / instructions.md
Last active February 6, 2021 17:35
enabling prettier for sublime

JsPrettier

  1. Command Palette

    "Ctrl/Cmd + Shift + P", then type "JsPrettier Format Code".

  2. Context Menu

Right-click the file view and select "JsPrettier Format Code".

@tangoabcdelta
tangoabcdelta / prettier.instructions.md
Last active February 5, 2021 07:19
If you're working on a React App with thousands of eslint warnings, first run prettier from the command line and prettify all files in a repository. It makes the hunting down easier for you (as a human, does do no benefit for the machine). Then, follow the instruction in the part of the gist, add them to your `package.json` and run them to fix `…
  • Prettify all JavaScript files: npx prettier --write "./src/**/*.js"

  • Check if your files are formatted: `npx prettier --check "src/**/*.js"

  • For more: https://prettier.io/docs/en/cli.html#--check

  • Simple commands: npx eslint --fix

  • Somewhat complicated command: npx eslint --fix --ext .js,.jsx .

Add these to the root package.json.