Skip to content

Instantly share code, notes, and snippets.

View manniru's full-sized avatar

MUHAMMAD MANNIR AHMAD manniru

View GitHub Profile
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,
@cedrickchee
cedrickchee / llama-7b-m1.md
Last active February 17, 2025 02:24
4 Steps in Running LLaMA-7B on a M1 MacBook with `llama.cpp`

4 Steps in Running LLaMA-7B on a M1 MacBook

The large language models usability

The problem with large language models is that you can’t run these locally on your laptop. Thanks to Georgi Gerganov and his llama.cpp project, it is now possible to run Meta’s LLaMA on a single computer without a dedicated GPU.

Running LLaMA

There are multiple steps involved in running LLaMA locally on a M1 Mac after downloading the model weights.

(venv) # Exit:0 2023-03-12 16:59:27 [r2q2@Reformer#[:~/opt/llama.cpp]
$(: !605 ) ./main -m ./models/65B/ggml-model-q4_0.bin -t 8 -n 128
main: seed = 1678658429
llama_model_load: loading model from './models/65B/ggml-model-q4_0.bin' - please wait ...
llama_model_load: n_vocab = 32000
llama_model_load: n_ctx = 512
llama_model_load: n_embd = 8192
llama_model_load: n_mult = 256
llama_model_load: n_head = 64
llama_model_load: n_layer = 80
@manniru
manniru / uuid.sh
Created October 17, 2022 04:20 — forked from markusfisch/uuid.sh
Generate a random UUID in bash
#!/usr/bin/env bash
# Generate a pseudo UUID
uuid()
{
local N B C='89ab'
for (( N=0; N < 16; ++N ))
do
B=$(( $RANDOM%256 ))
sudo tail -F /var/log/apache2/error.log
#EXTM3U
#EXTINF:-1,BBC One HD
https://vs-hls-push-uk-live.akamaized.net/x=4/i=urn:bbc:pips:service:bbc_one_hd/t=3840/v=pv14/b=5070016/main.m3u8
#EXTINF:-1,BBC One Wales HD
https://vs-hls-pushb-uk-live.akamaized.net/x=4/i=urn:bbc:pips:service:bbc_one_wales_hd/t=3840/v=pv14/b=5070016/main.m3u8
#EXTINF:-1,BBC One Northern Ireland HD
https://vs-hls-pushb-uk-live.akamaized.net/x=4/i=urn:bbc:pips:service:bbc_one_northern_ireland_hd/t=3840/v=pv14/b=5070016/main.m3u8
#EXTINF:-1,BBC One Scotland HD
https://vs-hls-pushb-uk-live.akamaized.net/x=4/i=urn:bbc:pips:service:bbc_one_scotland_hd/t=3840/v=pv14/b=5070016/main.m3u8
@Macarthurval
Macarthurval / mongo-auth.ts
Last active January 22, 2025 20:01
A typescript class to manage Baileys auth states in Mongo database
import { WAProto } from '@adiwajshing/baileys';
import { BufferJSON, initAuthCreds } from '@adiwajshing/baileys/lib/Utils';
import { Collection, Document, MongoClient } from 'mongodb';
import chalk from 'chalk';
export class MongoDbAuth{
static mongoUrl = "mongodb+srv://your-mongodb-url/DBName/?retryWrites=true&w=majority"
sim: string
private collection: Collection
@Cogentx
Cogentx / firebase-v9-firestore-react.tsx
Created March 8, 2022 23:08
Cloud Firestore - addDoc Example using Firebase v9 with Next.js | React | TypeScript
import { useRef } from 'react';
import Image from 'next/image';
import { useSession } from 'next-auth/react';
import { EmojiHappyIcon } from '@heroicons/react/outline';
import { CameraIcon, VideoCameraIcon } from '@heroicons/react/solid';
import { collection, addDoc, serverTimestamp } from 'firebase/firestore';
import { db } from '../firebase';
export default function InputBox() {
const { data: session } = useSession();
@manniru
manniru / String to Float.php
Created February 9, 2022 21:45 — forked from tristar500/String to Float.php
Convert string value with commas into a float
$val = "1,234,988.56";
$num = floatval(str_replace(",","",$val));
echo $num;
// returns - 1234988.56
find . -type f | xargs sudo chmod 644
find . -type d | xargs sudo chmod 755