Skip to content

Instantly share code, notes, and snippets.

View PatrickJS's full-sized avatar

PatrickJS PatrickJS

View GitHub Profile
@PatrickJS
PatrickJS / lambda.js
Last active November 10, 2023 19:23
versioned lambdas in s3
import * as https from 'https';
import { NodeHttpHandler } from '@aws-sdk/node-http-handler';
import { promises as fs } from 'fs';
import path from 'path';
import { S3Client, GetObjectCommand, ListObjectsV2Command } from '@aws-sdk/client-s3';
// Create an HTTPS agent with keep-alive enabled
const keepAliveAgent = new https.Agent({
keepAlive: true,
maxSockets: 50, // Maximum number of sockets to allow per host
import { component$, useVisibleTask$ } from "@builder.io/qwik";
import { useLocation } from "@builder.io/qwik-city";
// import the file we created
import { usePatternParamExtractor } from '~/hooks/pattern-param-extractor'
export default component$(() => {
const loc = useLocation();
@PatrickJS
PatrickJS / run.js
Created November 8, 2023 05:21 — forked from thdxr/run.js
Remove all linkedin connections
// Run on https://www.linkedin.com/mynetwork/invite-connect/connections/
while(true) {
document.querySelector('.mn-connection-card__dropdown-trigger').click()
await new Promise(resolve => setTimeout(resolve, 500))
document.querySelector(".artdeco-dropdown__content-inner button").click()
await new Promise(resolve => setTimeout(resolve, 500))
document.querySelector("[data-test-dialog-primary-btn]").click()
await new Promise(resolve => setTimeout(resolve, 500))
}
@PatrickJS
PatrickJS / downlink.js
Created November 6, 2023 05:45
navigator.connection.downlink or || I needed a quick way to determine if the user connection speed was fast enough to enable/disable some features in a site I’m working on, I made this little script that averages the time it takes to download a single (small) image a number of times, it's working pretty accurately in my tests, being able to clea…
@PatrickJS
PatrickJS / launch.json
Last active November 3, 2023 04:40
qwik fullstack debug. place a debugger then select "Qwik Debug" in the vscode debugger dropdown
{
"version": "0.2.0",
"configurations": [
{
"name": "qwik Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:5173",
"webRoot": "${workspaceFolder}",
"pathMapping": {
import { z } from "zod";
import { zodToTs, printNode } from "zod-to-ts";
// Replace with your `openai` thing
import { openai } from "../openai.server";
import endent from "endent";
function createJSONCompletion<T extends z.ZodType>({
prompt,
schema_name,
# STEP 1: Load
# Load documents using LangChain's DocumentLoaders
# This is from https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/csv.html
from langchain.document_loaders.csv_loader import CSVLoader
loader = CSVLoader(file_path='./example_data/mlb_teams_2012.csv')
data = loader.load()
This file has been truncated, but you can view the full file.
@import url(https://fonts.googleapis.com/css?family=Roboto:100,200,300,400,400i,500,600,700,800,900);
@import url(https://fonts.googleapis.com/css?family=Roboto:400,500,600,700);
@charset "UTF-8";/* You can add global styles to this file, and also import other style files *//*!
* NOTICE: (c) 2019 ConsumerInfo.com, Inc, an Experian company.
* All Rights Reserved.
* The material contained herein is protected by copyright and trade secret law.
* Unauthorized use, copying, or dissemination is strictly prohibited.
* All material contained herein is subject to Experian's confidential information policies.
* ----------------------------------------------------------------------------------------- */.ng1x .archive__page .archive__datatable-row .archive-ui-grid-cell--left .media-body p sup,.ng1x sup{top:-.8em}.ng1x .ecs-darkweb-free-scan *,.ng1x .ecs-darkweb-free-scan :after,.ng1x .ecs-darkweb-free-scan :before,.ng1x hr{box-sizing:content-box}.ng1x hr,.ng1x img{border:0}.ng1x{/*! normalize.css v3.0.0 | MIT Lice
{
"environment": "staging"
}
/*
Makes your remote containers low level API accessible via:
import accessFederatedContainer from "access-federated-containers";
accessFederatedContainer("app2")
*/
/** @typedef {import("webpack").Compiler} Compiler */
/** @typedef {import("webpack").Compilation} Compilation */