Skip to content

Instantly share code, notes, and snippets.

View mubaidr's full-sized avatar
🎯
Adding bugs to web applications!

Muhammad Ubaid Raza mubaidr

🎯
Adding bugs to web applications!
View GitHub Profile
@mubaidr
mubaidr / run-code-insiders.sh
Created February 15, 2025 17:29
Run vscode with gpu accceleration and vulkan enabled
#!/bin/bash
# Use the dedicated GPU
export DRI_PRIME=1
export MESA_LOADER_DRIVER_OVERRIDE=radeonsi
export vblank_mode=1
export mesa_glthread=true
export AMD_DEBUG=nir
export MESA_NO_ERROR=1
@mubaidr
mubaidr / 01.auth.global.ts
Created January 28, 2025 05:51
A sample implementation of middleware for Nuxt Atnetication whcih supports unauthenticated access.
export default defineNuxtRouteMiddleware(async (to) => {
const { loggedIn, user, clear } = useUserSession()
const auth = to.meta.auth as
| undefined
| boolean
| {
unauthenticatedOnly: boolean
navigateAuthenticatedTo: string | undefined
}
@mubaidr
mubaidr / config.yml
Last active October 10, 2024 19:16
Fusuma config to match kde behavior with macos: ~/.config/fusuma/config.yml
swipe:
4:
right:
sendkey: 'LEFTALT+RIGHT' # History forward
left:
sendkey: 'LEFTALT+LEFT' # History back
up:
sendkey: 'LEFTCTRL+t' # Open new tab
keypress:
LEFTSHIFT:
@mubaidr
mubaidr / tailwind.config.ts
Created September 30, 2024 09:46
tailwind css material themes based on Google Material Design 3 using @material/material-color-utilities
import type { Config } from "tailwindcss"
import {
argbFromHex,
hexFromArgb,
Hct,
SchemeContent,
} from "@material/material-color-utilities"
const SOURCE_COLOR = "#0192d1"
const argb = argbFromHex(SOURCE_COLOR)
{
"[dockerfile]": {
"editor.defaultFormatter": "ms-azuretools.vscode-docker"
},
"[dotenv]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
@mubaidr
mubaidr / gist:1c2d3be722b3e5274d70e7f353f37340
Created March 14, 2024 04:46
Free Windows Server 2022 Product Key
Free Windows Server 2022 Standard Product Key
HP9DJ-NK2X6-4QPCH-8HY8H-6X2XY
RRNMT-FP29D-CHKCH-GWQP2-DDDVB
44QN4-X3R72-9X3VK-3DWD6-HFWDM
Free Windows Server 2022 Datacenter Product Key
WX4NM-KYWYW-QJJR4-XV3QB-6VM33
Download windows Sever 2022 Evaluation edition:
Windows Server 2022 Evaluation English
@mubaidr
mubaidr / sse.ts
Created January 12, 2024 09:58 — forked from atinux/sse.ts
SSE endpoint example with Nuxt 3
// ~/server/api/sse.ts
export default defineEventHandler(async (event) => {
if (!process.dev) return { disabled: true }
// Enable SSE endpoint
setHeader(event, 'cache-control', 'no-cache')
setHeader(event, 'connection', 'keep-alive')
setHeader(event, 'content-type', 'text/event-stream')
setResponseStatus(event, 200)
@mubaidr
mubaidr / fix_vscode_copilot_cert.sh
Last active March 24, 2023 05:14 — forked from davidlu1001/fix_vscode_copilot_cert.sh
Fix Github Copilot cert issue behind proxy for VSCode
#!/usr/bin/env bash
set -uo pipefail
_VSCODEDIR="$HOME/.vscode-insiders/extensions"
_COPILOTDIR=$(ls "${_VSCODEDIR}" | grep -E "github.copilot-[1-9].*" | sort -V | tail -n1) # For copilot
_COPILOTDEVDIR=$(ls "${_VSCODEDIR}" | grep "github.copilot-nightly-" | sort -V | tail -n1) # For copilot-nightly
_COPILOTLABSDIR=$(ls "${_VSCODEDIR}" | grep "github.copilot-labs-" | sort -V | tail -n1) # For gitHub.copilot-labs
_EXTENSIONFILEPATH="${_VSCODEDIR}/${_COPILOTDIR}/dist/extension.js"
@mubaidr
mubaidr / filters.js
Created June 24, 2022 10:01 — forked from deckchairlabs/filters.js
Prisma Custom Generator
#!/usr/bin/env node
const path = require('path')
const generatorHelper = require('@prisma/generator-helper')
const { Project, StructureKind, VariableDeclarationKind } = require('ts-morph')
generatorHelper.generatorHandler({
onManifest(config) {
return {
prettyName: 'Filters',
defaultOutput: path.resolve(__dirname, 'filters'),
@mubaidr
mubaidr / find-missing-index.js
Created May 10, 2021 17:36
How to find missing indexes on foreign keys
// https://medium.com/@awesboss/how-to-find-missing-indexes-on-foreign-keys-2faffd7e6958
describe('database', () => {
describe('performance', () => {
it('has indexes on all foreign keys', async () => {
const query = `
WITH indexed_tables AS (
select
ns.nspname,
t.relname as table_name,