Source: https://www.youtube.com/watch?v=Wvf0mBNGjXY
$ echo $SHELL
>> shellvar
$ pwd
>> /home/my_dir1
| // 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; |
Source: https://www.youtube.com/watch?v=Wvf0mBNGjXY
$ echo $SHELL
>> shellvar
$ pwd
>> /home/my_dir1
| 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'))); | |
| }); |
| 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 |
| 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() { |
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)
| 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, { |
| "use client" | |
| import React, { useState, SetStateAction, Dispatch } from "react"; | |
| import { Color, colors } from "@/types" | |
| import { useIsomorphicLayoutEffect } from "usehooks-ts"; | |
| interface ThemeContextProps { | |
| theme: Color; | |
| setTheme: Dispatch<SetStateAction<Color>> | null; | |
| } |
| # Creating a next app from example template | |
| # All examples: https://github.com/vercel/next.js/tree/canary/examples | |
| yarn create next-app -e app-dir-mdx . |