# Find DS_Store
alias fds="find . -name .DS_Store"
# Delete DS_Store
alias dds="find . -name .DS_Store -type f -delete"
This file contains 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
/* | |
* Autoplay policy in Chrome - Chrome for Developers | |
* https://developer.chrome.com/blog/autoplay/#example_scenarios | |
* | |
* Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. | |
* https://stackoverflow.com/a/68128950/7738653 | |
*/ | |
const video = document.querySelector("video"); |
This file contains 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
const url = 'https://api.example.com/v1/sse'; | |
const accessToken = 'test'; | |
fetch(url, { | |
headers: { | |
Authorization: `Bearer ${accessToken}`, | |
}, | |
}) | |
.then(response => { | |
if (response.ok && response.body) { | |
reader = response.body.pipeThrough(new TextDecoderStream()).getReader(); |
This file contains 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 { useCallback, useEffect, useState } from "react"; | |
type DragInfo = { | |
startX: number; | |
startY: number; | |
top: number; | |
left: number; | |
width: number; | |
height: number; | |
}; |
export async function loginToGoogle() {
const { code } = getAuthParams(
(await chrome.identity.launchWebAuthFlow({
interactive: true,
url: `https://accounts.google.com/o/oauth2/v2/auth?${new URLSearchParams({
redirect_uri: chrome.identity.getRedirectURL(import.meta.env.VITE_CHROME_EXT_ID),
client_id: import.meta.env.VITE_GOOGLE_CLIENT_ID,
This file contains 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
var saveBlob = (function () { | |
var a = document.createElement("a"); | |
document.body.appendChild(a); | |
a.style = "display: none"; | |
return function (blob, fileName) { | |
var url = window.URL.createObjectURL(blob); | |
a.href = url; | |
a.download = fileName; | |
a.click(); | |
window.URL.revokeObjectURL(url); |
This file contains 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
/** | |
* this code is copied from https://github.com/open-wa/wa-decrypt-nodejs | |
* i just made it more simplified | |
*/ | |
const { default: axios } = require('axios'); | |
const crypto = require('crypto'); | |
const hkdf = require('futoin-hkdf'); | |
const atob = require('atob'); |
When submitting a project to GitHub, you might accidentally include sensitive information like passwords or email addresses. Here's how to remove those records, create a brand-new repository, and keep the code unchanged:
-
Create a new blank branch
git checkout --orphan latest_branch
-
Add all files
git add -A
-
Commit the changes
OlderNewer