Skip to content

Instantly share code, notes, and snippets.

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

Muhammad Ubaid Raza mubaidr

:shipit:
Adding bugs to web applications!
View GitHub Profile
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 / trim_canvas.js
Created October 3, 2020 16:28 — forked from timdown/trim_canvas.js
Returns a copy of a canvas element with surrounding transparent space removed
var trimCanvas = (function() {
function rowBlank(imageData, width, y) {
for (var x = 0; x < width; ++x) {
if (imageData.data[y * width * 4 + x * 4 + 3] !== 0) return false;
}
return true;
}
function columnBlank(imageData, width, x, top, bottom) {
for (var y = top; y < bottom; ++y) {
@mubaidr
mubaidr / nodejs-cheatsheet.js
Created July 17, 2020 06:09 — forked from LeCoupa/nodejs-cheatsheet.js
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@mubaidr
mubaidr / publish-ghpages.md
Created March 26, 2020 06:21 — forked from tduarte/publish-ghpages.md
If you need to force push an subtree
git checkout master # you can avoid this line if you are in master...
git subtree split --prefix dist -b gh-pages # create a local gh-pages branch containing the splitted output folder
git push -f origin gh-pages:gh-pages # force the push of the gh-pages branch to the remote gh-pages branch at origin
git branch -D gh-pages # delete the local gh-pages because you will need it: ref
@mubaidr
mubaidr / get-latest-tag-on-git.sh
Created March 24, 2020 13:58 — forked from rponte/get-latest-tag-on-git.sh
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
@mubaidr
mubaidr / gh-pages-deploy.md
Created August 16, 2019 17:49 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@mubaidr
mubaidr / migrate-assert-to-expect.js
Created August 14, 2019 13:46 — forked from robertleeplummerjr/migrate-assert-to-expect.js
A script that migrates from using assert to jest's expect
const { parse } = require('acorn');
const fs = require('fs');
const file = fs.readFileSync('./__tests__/file-name.js').toString();
const rootAST = parse(file, {
locations: true
});
function traverse(ast) {
if (Array.isArray(ast)) {
for (let i = 0; i < ast.length; i++) {