Skip to content

Instantly share code, notes, and snippets.

View thecmdrunner's full-sized avatar
🎯
Focusing

Pranav thecmdrunner

🎯
Focusing
View GitHub Profile
@thecmdrunner
thecmdrunner / fix-gh-notifications.ts
Created December 1, 2024 09:29
Marks all GitHub notifications as read using the GitHub API.
// Credits to djc in Discussions: https://github.com/orgs/community/discussions/6874#discussioncomment-2859125
const markAllNotificationsAsRead = async () => {
// Create one from https://github.com/settings/tokens
const githubPersonalAccessToken = "";
const res = await fetch("https://api.github.com/notifications", {
method: "PUT",
headers: {
Accept: "application/vnd.github.v3+json",

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

import { BlurImage, YouTube } from "@dub/ui";
import { nFormatter } from "@dub/utils";
import { Eye, UserCheck, Video } from "lucide-react";
import { Suspense } from "react";
export function YoutubeChannel({ id }: { id: string }) {
return (
<Suspense fallback={<div className="not-prose grid gap-4"></div>}>
<YoutubeChannelRSC id={id} />
</Suspense>
type Fields = Record<string, string>;
type EqualCondition = ["eq", string, string] | Record<string, string>;
type StartsWithCondition = ["starts-with", string, string];
type ContentLengthRangeCondition = ["content-length-range", number, number];
export type PolicyEntry =
| EqualCondition
@thecmdrunner
thecmdrunner / R2_storage.ts
Created March 20, 2024 11:05 — forked from AndrewIngram/R2_storage.ts
Read/write from Cloudflare R2 in a Vercel edge function w/default
import { AwsClient } from "aws4fetch";
import { deflate } from "pako";
const R2_ACCOUNT_ID = "SOMETHING"
const R2_ACCESS_KEY_ID = "SOMETHING"
const R2_SECRET_ACCESS_KEY ="SOMETHING"
const R2_BUCKET = "SOMETHING"
const R2_URL = `https://${R2_BUCKET}.${R2_ACCOUNT_ID}.r2.cloudflarestorage.com`;
// Credits: https://twitter.com/ulbrichpro/status/1727109499016933599
import fs from 'fs';
import path from 'path';
import OpenAI from 'openai';
// Initialize the OpenAI client
const openai = new OpenAI({ apiKey: 'API-KEY-HERE' }); // Replace with your actual API key
@thecmdrunner
thecmdrunner / ai-plugin.json
Created March 26, 2023 06:33 — forked from danielgross/ai-plugin.json
ChatGPT Plugin for Twilio
{
"schema_version": "v1",
"name_for_model": "twilio",
"name_for_human": "Twilio Plugin",
"description_for_model": "Plugin for integrating the Twilio API to send SMS messages and make phone calls. Use it whenever a user wants to send a text message or make a call using their Twilio account.",
"description_for_human": "Send text messages and make phone calls with Twilio.",
"auth": {
"type": "user_http",
"authorization_type": "basic"
},
@thecmdrunner
thecmdrunner / VFIO_nested.md
Created September 19, 2021 05:51 — forked from mcastelino/VFIO_nested.md
QEMU VFIO in Nested VM vIOMMU

How to use VFIO to assign a device to nested VM

  • Here the vfio-pci device is passed in into the L1 VM
  • The L1 VM is setup with kernel_irqchip=split
  • The L0 exposes a virtual IOMMU to the L1 VM
qemu-system-x86_64 \
    -machine q35,accel=kvm,kernel_irqchip=split \
    -enable-kvm \
@thecmdrunner
thecmdrunner / Secondary display using xrandr
Last active December 8, 2022 07:58
Linux: Using a Tablet as a secondary display
This guide uses [Deskreen](https://github.com/pavlobu/deskreen) on Pop! OS 20.04
# 1. Virtual Display Output
Deskreen can share any display as long as it is detected via `xrandr`, but to be able to have a display show up exlusively on a secondary device, there needs to be an unused display output. Most GPUs and laptops have additional display-out ports that can be used. But in my case, I use my TV as a primary display, while casting my laptop's screen to my phone, as my laptop's display doesn't work anymore.
## Add a Virtual Output
The idea is to make the system think that a display is connected to an unused display-out port (HDMI / DVI / DisplayPort) and sharing its contents to our secondary device via Deskreen.