Description - From left to right, sort the numbers in groups starting from 1 to the length of the array
Time complexity - O(n^2)
Space complexity - O(1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ytdl from "ytdl-core"; | |
import fs from "fs"; | |
import ffmpeg from "fluent-ffmpeg"; | |
import readline from "readline"; | |
// https://github.com/fent/node-ytdl-core/blob/master/example/convert_to_mp3.js | |
const id = 'nMfPqeZjc2c'; | |
let stream = ytdl(id, { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { PrismaClient } from "@prisma/client" | |
const prisma = new PrismaClient() | |
// const prisma = new PrismaClient({ log: ["query"]}) | |
// npx prisma generate | |
// to generate the types, if not, close and re-open file. If not, ctrl+click create to reload typescript | |
// npx prisma migrate dev --name test2 | |
async function main() { |
Windows Shortcut | MacOS | Function |
---|---|---|
Alt + Up/Down Arrow | Opt + Up/Down Arrow | Moves line of code up or down |
Alt + Shift + Up/Down Arrow | Opt + Shift + Up/Down Arrow | Duplicates line of code |
Ctrl + P | Cmd + P | Search and open a file quickly |
Ctrl + Shift + P | Cmd + Shift + P | Open up the command prompt |
Alt + Shift + F | Shift + Opt + F | Format document |
Ctrl + Shift + F | Shift + Cmd + F | Search for file |
Ctrl + Shift + E | Shift + Cmd + E | Open up file explorer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import crypto from "crypto"; | |
import fs from "fs"; | |
// Creates a sha256 hash from a file | |
export const createHashFromFile = (filePath: string) => new Promise(resolve => { | |
const hash = crypto.createHash('sha256'); | |
fs.createReadStream(filePath).on('data', data => hash.update(data)).on('end', () => resolve(hash.digest('hex'))); | |
}); |
Source: https://www.youtube.com/watch?v=Wvf0mBNGjXY
$ echo $SHELL
>> shellvar
$ pwd
>> /home/my_dir1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; | |
contract ECDSARecover { | |
using ECDSA for bytes32; | |
using ECDSA for bytes; |
NewerOlder