Skip to content

Instantly share code, notes, and snippets.

View stephenlb's full-sized avatar
😀
Coding with Rust

Stephen Blum stephenlb

😀
Coding with Rust
View GitHub Profile
@stephenlb
stephenlb / .screenrc
Created November 13, 2024 18:23
Terminal Setup GNU Screen
startup_message off
vbell on
msgwait 1
defscrollback 200000
hardstatus alwayslastline
hardstatus string '%{= kG}[ Stephen Blum ]%{g}[%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m/%d %{W}%c %{g}]'
caption string "%{W}%n%f %t%?(%u)%?%{r}"
rendition so =rb 04
@stephenlb
stephenlb / README.md
Last active November 8, 2024 06:35
FemtoGPT Inference Mode

FemtoGPT Inference Mode

To compile and execute the program from a different source file, such as infer.rs, and name the resulting binary infer, follow these modified instructions:

Step-by-step Instructions

  1. Update Project Structure: Create a new source file named infer.rs in the src directory.

    touch src/infer.rs
@stephenlb
stephenlb / blip2-bettertransformer.py
Last active August 30, 2024 20:09
Blip2 transformer with BetterTransformer HuggingFace Optimum 🚀
# YouTube Video https://youtu.be/SDCzXr-mBcw
import torch
import requests
from PIL import Image
from transformers import Blip2Processor, Blip2ForConditionalGeneration
from optimum.bettertransformer import BetterTransformer
# Load the processor and model
processor = Blip2Processor.from_pretrained("Salesforce/blip2-flan-t5-xl")
Images from 120ms to 30ms: Python 🐍 to Rust 🦀🚀 article
@stephenlb
stephenlb / README.md
Created June 19, 2024 23:45
AsyncIO PubNub Subscribe Example

AsyncIO PubNub Subscribe Example

pubnub-asyncio-simple-example

Usage example:

pip install asyncio pubnub
export PUBNUB_PUBLISH_KEY=demo
export PUBNUB_SUBSCRIBE_KEY=demo
python main.py
@stephenlb
stephenlb / 1-new-project-preactjs.md
Last active June 11, 2024 18:10
ReactJS vs Preact JS - Differences and Performance

ReactJS vs Preact: New Project

Preact has smaller library files compared to React. Here is a detailed comparison:

Library Size

  • React: The minified and gzipped production build of React typically weighs around 60 KB.
  • Preact: The minified and gzipped version of Preact is significantly smaller, approximately 6 KB.

Other Considerations

  1. API Compatibility: Preact aims to be as compatible as possible with React's API, but there are some differences and limitations. For example, not all of React's advanced features or third-party libraries may work seamlessly with Preact.
@stephenlb
stephenlb / yolo-ultralytics-object-detection.md
Last active June 19, 2024 03:50
YOLO Ultralytics Object Detection in Images

YOLO Object Detection: Image Recognition Software Guide

Introduction

YOLO (You Only Look Once) is a popular object detection algorithm well-documented by Ultralytics. For more comprehensive details, visit the Ultralytics YOLO documentation.

Docker Ultralytics

To perform object detection using YOLO in a Docker environment, you can run the following commands:

# Install
{"found":1732,"posts":[{"ID":58297,"site_ID":3584907,"author":{"ID":208647015,"login":"zaguiini","email":false,"name":"Luis Felipe Zaguini","first_name":"Luis Felipe","last_name":"Zaguini","nice_name":"zaguiini","URL":"","avatar_URL":"https:\/\/0.gravatar.com\/avatar\/98f8c3715a923d21291ae969b3c9921a474113d05a15bf3774c1010f47a99ac9?s=96&d=retro","profile_URL":"https:\/\/gravatar.com\/zaguiini","site_ID":14140874},"date":"2024-03-18T12:00:00+00:00","modified":"2024-03-18T13:01:56+00:00","title":"Just Launched: GitHub Deployments","URL":"http:\/\/en.blog.wordpress.com\/2024\/03\/18\/github-deployments\/","short_URL":"https:\/\/wp.me\/pf2B5-fah","content":"\n<p>Say goodbye to the hassle of manual file uploads and tedious deployments, and say hello to WordPress.com\u2019s new <a href=\"https:\/\/developer.wordpress.com\/docs\/developer-tools\/github-deployments\/?utm_source=automattic_referral&amp;utm_medium=referral&amp;utm_campaign=github-deployments-blog-post\">GitHub Deployments<\/a>.<\/p>\n\n\n\n<p>With GitH
@stephenlb
stephenlb / huggingface-pubnub-function.js
Last active April 9, 2024 07:04
PubNub Functions HuggingFace - use any model from HuggingFace Serverless API inside PubNub Functions
//
// ** **
// ** Add your API Key to MY SECRETS (Left Panel) **
// ** **
// ** HUGGINGFACE_API_KEY as the Secret Name **
// ** **
//
let HUGGINGFACE_API_KEY = null;
function getAPIKey() {
// Use cached key
const http = require("xhr");
const pubnub = require("pubnub");
// const dataUrl = 'https://gist.githubusercontent.com/stephenlb/2ed6782ee9ad47854dfb26028e0ca79c/raw/b6c9580ce624cfadc5be66123e3a1df1165dd047/test-data.json';
const dataUrl = 'https://gist.githubusercontent.com/stephenlb/2ed6782ee9ad47854dfb26028e0ca79c/raw/9fc8b7e62fcb7fcdfe3ce87f7003b316540fba1b/test-data-300.json'
let data = null;
let position = 0;
/* data synth sinusoidal */
const wavelength = 20;