Skip to content

Instantly share code, notes, and snippets.

View technikhil314's full-sized avatar

Nikhil Mehta technikhil314

View GitHub Profile
@technikhil314
technikhil314 / Readmd.MD
Last active April 24, 2024 17:13
Trick to use secondary gmail secondary account as default in PWA on desktop

Issue

  1. Open gmail.com
  2. switch to secondary accuont in gmail
  3. install a Gmail as PWA on desktop as a seperate window
    • make sure the PWA has secondaary account opened in PWA window
  4. Quit the PWA and open it again
  5. Obeserve that
    • the primary account is opened in PWA always no matter how many times you quit and reopen
    • also you cant switch the account in PWA to secondary account
    • if you try to switch to the secondary account then it is opened in browser and not in PWA
@technikhil314
technikhil314 / multiple_ssh_setting.md
Created April 12, 2024 06:46 — 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"
[
{
"id": 342,
"first_name": "Imelda",
"last_name": "Seamark",
"email": "iseamark0@mozilla.org",
"gender": "Agender",
"ip_address": "239.185.36.189"
},
{
@technikhil314
technikhil314 / generateDigest.js
Last active November 30, 2023 09:55
Generate sha-256 hash using crypto in browsers
const text = 'An obscure body in the S-K System, your majesty. The inhabitants refer to it as the planet Earth.';
async function digestMessage(message) {
const msgUint8 = new TextEncoder().encode(message); // encode as (utf-8) Uint8Array
const hashBuffer = await crypto.subtle.digest('SHA-256', msgUint8); // hash the message
const hashArray = Array.from(new Uint8Array(hashBuffer)); // convert buffer to byte array
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); // convert bytes to hex string
return hashHex;
}
@technikhil314
technikhil314 / publicEmailProviders.txt
Last active August 15, 2023 21:21
List of all public email provider domains
123mail.org
150mail.com
150ml.com
16mail.com
2-mail.com
4email.net
50mail.com
aim.com
airpost.net
alice.it
@technikhil314
technikhil314 / minimalHeaviestSetA.js
Created April 23, 2022 03:34
Amazon optimizing box weight
function minimalHeaviestSetA(arr) {
let result = [];
const sum = (arr) => arr.reduce((acc, curr) => acc + curr, 0);
const sortedArr = [...arr].sort((x, y) => x - y > 0 ? -1 : 1);
const n = sortedArr.length;
const target = sum(arr) / 2
for(let i = 0; i < n; i++) {
if(sum(result) > target) {
break
}
@technikhil314
technikhil314 / To Create Karaoke.sh
Created May 15, 2022 07:33
Useful ffmpeg and youtube downloading commands
// download some lytrical video from youtube using youtubelink
yt-dlp "someYoutubeLink" --extractor-args youtube:player_client=android --throttled-rate 100K -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best"
// merge downloaded youtube lyrical video with karaoke audio to create karaoke video trakc
ffmpeg -i someVideo.mp4 -i someAudio.mp3 -c:v copy -c:a aac -map 0:v:0 -map 1:a:0 "Output Karaoke.mp4"
@technikhil314
technikhil314 / index.js
Last active May 4, 2022 05:29
Flatten javascript object
let o = {
k: 10,
a: {
b: {
c: ["10", "20"]
},
},
d: {
e: 20
},
@technikhil314
technikhil314 / numberOfItems.js
Created April 23, 2022 02:42
Amazon number of items in container
function numberOfItems(s, startIndices, endIndices) {
// Write your code here
let result = [];
const countArr = {}
let count = 0
for(let i = s.indexOf("|"); i< s.length; i++) {
if(s[i] === "|") {
countArr[i] = count;
} else {
count++;