Skip to content

Instantly share code, notes, and snippets.

View Raidus's full-sized avatar

Wilhelm R. Raidus

View GitHub Profile
@gsans
gsans / gist:e40451bde73bf2d0fc3b1e74fb4ee8d8
Created June 27, 2024 22:49
Sonnet 3.5 system prompt
<artifacts_info>
The assistant can create and reference artifacts during conversations. Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity.
# Good artifacts are...
- Substantial content (>15 lines)
- Content that the user is likely to modify, iterate on, or take ownership of
- Self-contained, complex content that can be understood on its own, without context from the conversation
- Content intended for eventual use outside the conversation (e.g., reports, emails, presentations)
- Content likely to be referenced or reused multiple times
@kallebysantos
kallebysantos / App.tsx
Last active September 12, 2024 17:46
Running Local AI models with FastAPI and Vercel AI SDK
import "./App.css";
import { useEffect, useState } from "react";
import { useCompletion } from "ai/react";
function App() {
const [apiResponse, setApiResponse] = useState("");
useEffect(() => {
fetch("/api/reply?value=Hello from React App!")
.then((response) => response.json())
@Hansimov
Hansimov / frp-proxy.md
Last active August 14, 2024 05:37
Use FRP proxy to forward network traffic

Background

  • Machine PRIVATE has limited access to public network.
  • Machine PUBLIC has full access to publick network.

Target

  • Enable PRIVATE to visit public network with same access with PUBLIC.

Solution

Download related version of FRP, both in PRIVATE and PUBLIC:

@blackrez
blackrez / example_thread.py
Created February 6, 2022 19:39
duckdb with thread
from multiprocessing import connection
from time import sleep, perf_counter
from threading import Thread
import duckdb
con = duckdb.connect(database=':memory:')
con.execute("CREATE TABLE items(item VARCHAR, value DECIMAL(10,2), count INTEGER)")
con.execute("INSERT INTO items VALUES ('jeans', 20.0, 42), ('hammer', 42.2, 4242)")
@sdesalas
sdesalas / Async.gs
Last active August 23, 2024 11:43
Asynchronous execution for Google App Scripts (gas)
/*
* Async.gs
*
* Manages asyncronous execution via time-based triggers.
*
* Note that execution normally takes 30-60s due to scheduling of the trigger.
*
* @see https://developers.google.com/apps-script/reference/script/clock-trigger-builder.html
*/
@tolgamorf
tolgamorf / ubuntu-server-setup.sh
Last active January 7, 2022 05:13
Ubuntu server setup: Miniconda + Node.js + npm + PM2
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install -y nodejs
sudo npm install pm2@latest -g
# pm2 startup
sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u ubuntu --hp /home/ubuntu
sudo chown ubuntu:ubuntu /home/ubuntu/.pm2 /home/ubuntu/.pm2/rpc.sock /home/ubuntu/.pm2/pub.sock
@syntaqx
syntaqx / cloud-init.yaml
Last active September 9, 2024 10:04
cloud init / cloud config to install Docker on Ubuntu
#cloud-config
# Option 1 - Full installation using cURL
package_update: true
package_upgrade: true
groups:
- docker
system_info:
require('dotenv').config()
const cors = require('cors')
const bodyParser = require('body-parser')
const express = require('express')
const expressJwt = require('express-jwt')
const cookieSession = require('cookie-session')
const jwt = require('jsonwebtoken')
const passport = require('passport')
const GoogleStrategy = require('passport-google-oauth20').Strategy
const jwtSecret = Buffer.from('Zn8Q5tyZ/G1MHltc4F/gTkVJMlrbKiZt', 'base64')
@sberryman
sberryman / Dockerfile.yml
Last active July 13, 2020 12:06
DeepMatching GPU version on Ubuntu 16.04 (Docker)
FROM nvidia/cuda:8.0-cudnn5-devel
# PYTHON 2, DO NOT USE PYTHON 3!
LABEL maintainer "Shaun Berryman <shaun@shaunberryman.com>"
# Supress warnings about missing front-end. As recommended at:
# http://stackoverflow.com/questions/22466255/is-it-possibe-to-answer-dialog-questions-when-installing-under-docker
ARG DEBIAN_FRONTEND=noninteractive
@tegansnyder
tegansnyder / Preventing-Puppeteer-Detection.md
Created February 23, 2018 02:41
Preventing Puppeteer Detection

I’m looking for any tips or tricks for making chrome headless mode less detectable. Here is what I’ve done so far:

Set my args as follows:

const run = (async () => {

    const args = [
        '--no-sandbox',
        '--disable-setuid-sandbox',
        '--disable-infobars',