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
@yellinben
yellinben / vscode_proxy.jsonc
Last active March 28, 2024 07:30
Allow HTTP proxy in VS Code & Copilot
// Add these settings at the end of VSCode's `settings.json` file to allow HTTP inspection.
// For use with any MITM, self-signed HTTP proxy (Proxyman, Charles, Fiddler, etc).
// Last tested on VSCode 1.78.2. It's possible security settings will be hardened in future releases.
// Make sure to enable SSL-proxying of relevant hostnames to intercept complete requests/responses.
// For Copilot: `copilot-proxy.githubusercontent.com`
// These settings are obviously not secure, so disable them when not needed!
{
/* rest of your vscode settings */
@Atinux
Atinux / sse.ts
Last active June 4, 2024 05:47
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)
@lukeed
lukeed / cron-human.ts
Last active May 7, 2023 18:53
cron syntax & human readable output — https://t.co/CBThaezwzC
// https://crontab.guru/
// https://www.typescriptlang.org/play?ts=4.9.5#code/C4TwDgpgBAwgSgeQHJQLxQAYBIDe9kB0AogB5gBOEAzlQJYD2AdgL5S75LFmU0Mtt5EnUhWp0mrdkK6jeEgRxk9xLDAG4AUAHotUPVAB6Afg0bQkKABVqwAIxpY0gBIBXALYBDRgB4ARAGYABigATigAKgiI3wA+TR19QxMzcGhrKmAAJgdFV08fX0iwyJLY+N19Y1NzNJt-HOd3Lz9wrXriqPCy7Qq9KpSLdOAAFgbCPObCtoitUZLouJ7E-pqrGwBWMc4Jgtb6+dLFhMrk1aGANi2CHZaZ-c7u477T1LWMgHYrm99bTdbsg6PXpJaqvIYADi+TV2UXuXSOwJWYJsYXQuWhtxK00O5WWL0GNlswTRjXymKg+y0AKBeNBBIytnsJPGGMKsJm2WGNJOdNqDOyzO2rOCmUpAOxs25z15bzs9UF11ZYVFHLuUC5CNpAz5dlGCu+rV+M0ukX2UpB2tlRv1rIOFIWuJ5SwAtK6AMYuYCu52mAAmEDdABsPJQoIwPG5qGAPG7oBwoDgNHoIGR6ORgFBViJlHwHABycJ5qAAHzD7gARhByCXMK1cIwK1XmOpTMnU+nM68bpYoCngBBGL6qI5kDEHEnElZeyR+4Ph9gcLRGAAzKtQACykkXK7XTi3S9X1YAIpuBAe1+vT7hz8eAOrNieTqBGKy0SPeJwAGnXY77A6HmDXju1Y9n+c5QBk5BLgA5g+T6JC+R4eCA3iXp+UAnuhR63r+M7-vOQGHhh06zgBkEwXB8EIcRYEAb4vhQI+VH6C+lhMcxUAAFyATglisEwAhHpRHHcYwEAAG5Vuxk6iRJUlUbJknkJoE4JN6jETmcb4QB+9AuOQ6HrkunoQGO6BMUZDb9iR+FQAWRbSS+Th6dWtHDvZegvnmcnkCAUBuMZ-ZFgk8wAPpQOFoXSdxzn6TZ4ELjeUBOPFAENm4
@Dlfaith
Dlfaith / gist:0d43be3dfb296bb6260af75ef082faa8
Created December 6, 2022 02:51
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
@davidlu1001
davidlu1001 / fix_vscode_copilot_cert.sh
Created March 13, 2022 22:54
Fix Github Copilot cert issue behind proxy for VSCode
#!/usr/bin/env bash
set -uo pipefail
_VSCODEDIR="$HOME/.vscode/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
_EXTENSIONFILEPATH="${_VSCODEDIR}/${_COPILOTDIR}/dist/extension.js"
_DEVEXTENSIONFILEPATH="${_VSCODEDIR}/${_COPILOTDEVDIR}/dist/extension.js"
@deckchairlabs
deckchairlabs / filters.js
Created May 17, 2021 03:04
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'),
@robertleeplummerjr
robertleeplummerjr / migrate-assert-to-expect.js
Created August 14, 2019 10:30
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++) {
@nebrius
nebrius / typescript-setup.md
Last active May 13, 2023 01:07
Instructions for configuring TypeScript for Node.js

This gist will walk you through configuring your Node.js Project so that you can write your code in TypeScript using Visual Studio Code. These isntructions were written for attendees at Microsoft Build doing a super secret thing I can't talk about (ooo, the suspense!), but they also will work for any Node.js project written in TypeScript.

Before we get started configuring TypeScript, we need to initialize a new Node.js project. If you have not already installed Node.js, please head over to nodejs.org and install the latest LTS version of Node.js. Once this is done, create a folder for your Node.js project and open a terminal in this folder. In the terminal, run the command:

npm init

This command will ask you a series of questions. You can use the defaults for each question here because they don't really matter. These only matter if you intend to publish your module to [npmjs.com](htt

@mac2000
mac2000 / index.html
Created March 25, 2018 11:28
brain.js demo
<!DOCTYPE html>
<html>
<head>
<title>brain.js</title>
<script src="https://cdn.rawgit.com/BrainJS/brain.js/develop/browser.js"></script>
<script>
function DrawableCanvas(el) {
const px = 10
const ctx = el.getContext('2d')
let x = []
@tduarte
tduarte / publish-ghpages.md
Last active May 18, 2024 13:52
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