Skip to content

Instantly share code, notes, and snippets.

View mcnaveen's full-sized avatar
🦄

MC Naveen mcnaveen

🦄
View GitHub Profile

Keybase proof

I hereby claim:

  • I am mcnaveen on github.
  • I am mcnaveen (https://keybase.io/mcnaveen) on keybase.
  • I have a public key ASDzKr0MnqufT5irHvdpGlnh44qxByGTb618ESfeCRqb8wo

To claim this, I am signing this object:

const colorTableBody = document.querySelector('.color-table__body');
if (colorTableBody) {
const rows = colorTableBody.querySelectorAll('tr');
const colorNames = [];
rows.forEach(row => {
const colorNameElement = row.querySelector('.color-table__cell.color-table__cell--name');
if (colorNameElement) {
const colorName = colorNameElement.innerText;
colorNames.push(colorName);
}
@mcnaveen
mcnaveen / code.js
Created September 30, 2023 17:52
Add Copy Button to Ghost P Tag
<script>
document.addEventListener("DOMContentLoaded", function () {
var paragraphs = document.querySelectorAll(".gh-content p");
paragraphs.forEach(function (paragraph) {
var copyButton = document.createElement("button");
copyButton.className = "copy-btn";
copyButton.setAttribute("data-umami-event", "Copy button");
copyButton.innerHTML = "&#x1F4CB;";
#!/bin/bash
# URL of the Android Studio download page
URL="https://developer.android.com/studio"
# CSS selector to target the element
SELECTOR="#agree-button__studio_linux_bundle_download"
# Use curl to fetch the web page content and pipe it to grep
# -s: Silent mode (suppresses progress meter)
@mcnaveen
mcnaveen / file.md
Created August 18, 2023 05:44
Use MacBook in Camshell Mode (Lid Closed) without power adapter connected

Open the terminal and run the below command

pmset -g | grep hibernatemode

Note down the number in safe place, you'll need this later if you want to disable it

Now, run the below commands one by one.

Image will be uploaded
@mcnaveen
mcnaveen / findProperty.js
Created August 6, 2023 15:55
Notion Helper Function to find property value by name
const findPropertyValue = (results, propertyName) => {
const property = results.find((item: { properties: { Key: { title: { text: { content }; }[]; }; }; }) => item.properties.Key.title[0].text.content === propertyName);
return property ? property.properties.Value.rich_text[0].text.content : null;
};
// then just do
const somevar = findPropertyValue(response.results, "My Phone Number")
// Table should follow this structure
https://imgur.com/a/P2kssZV
@mcnaveen
mcnaveen / blurhash.sh
Created July 11, 2023 10:41
Bash Script to Generate blurhash for all the images in the folder.
#!/bin/bash
# Prerequisite: Node, NPX
folder_path="Wallpapers"
for file_path in "$folder_path"/*.{jpg,png,jpeg}; do
if [[ -f "$file_path" ]]; then
echo "Generating Blurhash for $file_path"
npx blurhash-cli "$file_path" --local
echo "============================================"
upstream freshrss {
server 127.0.0.1:3500;
keepalive 64;
}
server {
listen 80;
listen [::]:80;
listen 443 ssl http2;