Skip to content

Instantly share code, notes, and snippets.

View harshit-budhraja's full-sized avatar
👋
Waving at you!

Harshit Budhraja harshit-budhraja

👋
Waving at you!
View GitHub Profile
@kettanaito
kettanaito / README.md
Last active April 26, 2024 08:01
Chromium on Vercel (serveless)

Chromium on Vercel (serverless)

This is an up-to-date guide on running Chromium in Vercel serverless functions in 2022. What you will read below is the result of two days of research, debugging, 100+ failed deployments, and a little bit of stress.

Getting started

Step 1: Install dependencies

Use chrome-aws-lambda that comes with Chromium pre-configured to run in serverless, and puppeteer-core due to the smaller size of Chromium distributive.

@agungjk
agungjk / [slug].js
Last active April 7, 2024 15:22
Crawler example on Vercel using Puppeteer and NextJS API routes
const puppeteer = require('puppeteer-core');
const cheerio = require('cheerio');
const chrome = require('chrome-aws-lambda');
export default async (req, res) => {
const slug = req?.query?.slug;
if (!slug) {
res.statusCode = 200
res.setHeader('Content-Type', 'application/json')
res.end(JSON.stringify({ id: null }))
@Tynael
Tynael / README.md
Last active January 22, 2024 01:06
How to use npx to run gist based scripts
@apal21
apal21 / S3 getObject async-await.js
Last active March 20, 2024 19:47
AWS S3 getObject using async/await
const s3 = new AWS.S3(accessparams);
(async () => {
try {
const file = await s3
.getObject({ Bucket: 'BUCKET-NAME', Key: 'path/to/your/file' })
.promise();
console.log(file.Body);
} catch (err) {
console.log(err);
@fanjin-z
fanjin-z / csgo-server-guide.md
Last active November 11, 2023 17:20
Complete Guide for Hosting CS:GO Dedicated Servers

Complete Guide for Hosting a CS:GO Dedicated Server

Creative Commons License.

I tested the setup on Debian Stretch (naive installation) and Jessie (LinuxGSM installation). The setup should work on Debian 8 (Jessie), Debian 9 (Stretch) and Ubuntu (16.04). However, If you're running on Windows or other non-debian based Linux OS (e.g. CentOS, openSUSE), this guide doesn't apply to you.

My Servers:

I'm hosting FFA warm-up and HvH(soon) servers in San Francisco, welcome to join by:

IPv4: 159.89.154.137   
Ipv6: 2604:a880:2:d0::20ad:2001 
@TooTallNate
TooTallNate / http-error.js
Created August 3, 2016 00:48
HTTPError class for JavaScript HTTP errors
import { format } from 'url';
import { STATUS_CODES } from 'http';
import uppercamelcase from 'uppercamelcase';
class HTTPError extends Error {
constructor(code, message, extras) {
super(message || STATUS_CODES[code]);
if (arguments.length >= 3 && extras) {
Object.assign(this, extras);
}
@leecardona
leecardona / RegEx for HTTP Status Codes
Created May 4, 2014 17:25
Javascript Regular Expression for valid HTTP Status Codes
//DEFINE REGEX - valid input range is 100 thru 599
var regEx = /^[1-5][0-9][0-9]$/
//TEST REGEX
regEx.test(99)
=>false
regEx.test(100)
=>true