Skip to content

Instantly share code, notes, and snippets.

View rayanfer32's full-sized avatar
☢️
Radioactive

Rayan fernandes rayanfer32

☢️
Radioactive
View GitHub Profile
@rayanfer32
rayanfer32 / ollama-stream.js
Created May 2, 2024 11:44
Read the ollama response as a stream
const axios = require("axios");
const BASE_URL = "http://localhost:11434/api/generate";
axios({
method: "post",
url: BASE_URL,
data: {
"model": "llama3",
"prompt": "Tell me a joke"
@rayanfer32
rayanfer32 / usePeerStateSync.js
Created April 22, 2024 18:23
A useful hook to keep state synced across all the connected peers
import { useCallback, useEffect, useRef, useState } from "react";
export default function usePeerStateSync(
initialState,
peer,
onConnection,
isHost
) {
const [state, setState] = useState(initialState);
@rayanfer32
rayanfer32 / remotasks_library_problem.java
Created December 23, 2023 05:07
remotasks_library_problem.java
// MainTest.java
package tests;
import src.Main;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.BeforeAll;
public class MainTest {
@BeforeAll
static void setUp() {
@rayanfer32
rayanfer32 / keep-mono-font.js
Last active March 18, 2024 11:23
Monospace fonts for google keep notes
// ==UserScript==
// @name Google Keep monospace font
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://keep.google.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com
// @grant none
// ==/UserScript==
@rayanfer32
rayanfer32 / autogen-example.py
Created October 25, 2023 06:55
autogen-example.py
import autogen
config_list = [{
'api_type': 'open_ai',
'api_base': "http://172.18.240.1:1234/v1",
'api_key': "NULL",
}]
llm_config = {
'request_timeout': 600,
// ==UserScript==
// @name Big images
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://doodstream.com/search
// @icon https://www.google.com/s2/favicons?sz=64&domain=doodstream.com
// @grant none
// ==/UserScript==
"""
Run this script using `python backup_stashes.py`
To apply the stash use command
`git apply path/to/stash.patch`
"""
import os
import re
import hashlib
<!DOCTYPE html>
<html>
<head>
<link href="https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap" rel="stylesheet">
<title>Create Invoice</title>
<style>
body {
font-family: 'Space Mono', monospace, Arial, sans-serif;
background-color: #f2f2f2;

Handbrake-tut

Video compression with handbrake-cli

You never even touched upon the "video" tab ... where all the most important HandBrake options for video optimization and filesize reduction are (although, I realize it might seem a little intimidating if you don't know what they do). Perhaps I could help.

Your reduced ~500Mb export could have easily been reduced further to around ~200Mb just from experimenting with the video export options on that tab. Meaning, your average 1 hour upload time could be slashed again in half without any apparent loss in quality. If you're uploading regularly, this could be a real time-saver for you, since once you've found the right optimization, you can save the settings to a preset, which you can just select for all subsequent transcodes.

I've been using HandBrake for many years now. The best version to use is "HandBrake Nightly" as it's their most optimized and up-to-date build: Just Google: "HandBrake Nightly" for the official download website

Once you find your perf

DESIGN AND FABRICATION OF SMART TOILET CLEANER
#include <LiquidCrystaI.h> // includes the LiquidCrystaI Library
#define rightMotorDir 2 //Sprayer Motor
#define rightMotorPwm 3
#define leftMotorDir 4 //Brush Motor
#define leftMotorPwm 5