Skip to content

Instantly share code, notes, and snippets.

View phoward38's full-sized avatar

Patrick Howard phoward38

View GitHub Profile
@thierrymoudiki
thierrymoudiki / Makefile
Last active January 14, 2025 08:33
R package workflow (assuming you're on macOS or Linux). You can chain commands `make check&&make install`. See also https://thierrymoudiki.github.io/blog/2024/08/30/r/makefile-r-pkg2.
.PHONY: build buildsite check clean cleanvars coverage docs getwd initialize install installcranpkg installgithubpkg installedpkgs load removepkg render setwd start test usegit
.DEFAULT_GOAL := help
# The directory where R files are stored
R_DIR = ./R
define BROWSER_PYSCRIPT
import os, webbrowser, sys
from urllib.request import pathname2url
@ianmacartney
ianmacartney / llm.ts
Last active December 5, 2024 16:30
Implementation of chat completions and embeddings for any OpenAI-compliant services, using browser fetch and no imports/dependencies
export const CONFIG = {
// Together AI:
url: "https://api.together.xyz",
chatModel: "meta-llama/Llama-3-8b-chat-hf",
embeddingModel: "togethercomputer/m2-bert-80M-8k-retrieval", // dim 768
// OpenAI:
// url: "https://api.openai.com",
// chatModel: "gpt-4o",
// embeddingModel: "text-embedding-ada-002", // dim 1536
};
@jimbrig
jimbrig / README.md
Created February 17, 2024 02:13
GitHub Markdown Callouts
@lambdaxyzt
lambdaxyzt / image.jsx
Last active March 6, 2025 10:49
Remix Image Component ( use cache 'cacashe library' , stream base , sharp library )
// resource route component
import React from "react";
import { PassThrough } from "node:stream"
import fs from "node:fs"
import {createReadableStreamFromReadable} from "@remix-run/node"
import { defaultQuality,widths,mainImageReadStream,generatedImageReadstream, isThereImage,BadImageResponse } from "../../util/image.server"
export const loader = async ({ request }) => {
const url = new URL(request.url);
const src = url.searchParams.get("src");
@RamiKrispin
RamiKrispin / app.R
Created September 25, 2023 03:28
Forecasting Sandbox Example
# Forecasting Sandbox ----
# This is an example for a Shinylive R app
# The app provides a forecasting sandbox for the AirPassengers dataset
# It supports 3 stats forecasting models - Linear Regression, ARIMA, and Holt-Winters
library(shiny)
data(AirPassengers)
# UI ----
ui <- fluidPage(
@Horat1us
Horat1us / strongswan.md
Created June 5, 2023 13:45
Configuring Site-to-Site IPSec VPN

Configuring Site-to-Site IPSec VPN on Ubuntu using Strongswan

Requirements

This instruction is tested on Ubuntu 22.04 LTS

Open ports

  • UDP 4500
  • UDP 500
  • Custom protocol 50
@stla
stla / asynchronousShinyApp.R
Last active September 22, 2023 17:32
Asynchronous Shiny app.
library(shiny)
library(DT)
library(plotly)
library(chron)
library(promises)
library(future)
plan(multisession)
longProcess <- function(wait) {
start <- Sys.time()
###################################################################
folder_path <- "diamond csv storage"
csv_file_path <- paste0(folder_path, "/diamonds.csv")
xlsx_file_path <- paste0(folder_path, "/diamonds.xlsx")
import type { V2_HtmlMetaDescriptor, V2_MetaFunction } from "@remix-run/node";
export const mergeMeta = (
overrideFn: V2_MetaFunction,
appendFn?: V2_MetaFunction,
): V2_MetaFunction => {
return arg => {
// get meta from parent routes
let mergedMeta = arg.matches.reduce((acc, match) => {
return acc.concat(match.meta || []);
@pudquick
pudquick / brew.md
Last active February 24, 2025 18:19
Lightly "sandboxed" homebrew on macOS

brew is a bad neighbor

This isn't a guide about locking down homebrew so that it can't touch the rest of your system security-wise.

This guide doesn't fix the inherent security issues of a package management system that will literally yell at you if you try to do something about "huh, maybe it's not great my executables are writeable by my account without requiring authorization first".

But it absolutely is a guide about shoving it into its own little corner so that you can take it or leave it as you see fit, instead of just letting the project do what it likes like completely taking over permissions and ownership of a directory that might be in use by other software on your Mac and stomping all over their contents.

By following this guide you will:

  • Never have to run sudo to forcefully change permissions of some directory to be owned by your account