Skip to content

Instantly share code, notes, and snippets.

View ssghost's full-sized avatar
🏠
Working from home

Stardust Song ssghost

🏠
Working from home
View GitHub Profile
@ssghost
ssghost / phi-4-unsloth-notebook.ipynb
Created January 17, 2025 08:17
Phi-4 Unsloth notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def gauss_elim(m: List[List[float]], eps: float = 1.0/(10**10)) -> bool:
(h, w) = (len(m), len(m[0]))
for i in range(h):
maxrow = i
for j in range(i+1, h):
if abs(m[j][i]) > abs(m[maxrow][i]):
maxrow = j
(m[i], m[maxrow]) = (m[maxrow], m[i])
if abs(m[i][i]) <= eps:
return False
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
<style>
body {
padding: 1rem;
use mlua::{IntoLua, Lua, Value};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let lua = Lua::new();
let utils = lua.create_table()?;
let double_fn = lua.create_function(|lua: &Lua, arg_0: i64| {
let res = arg_0 * 2;
res.into_lua(lua)
})?;
import asyncio
import base64
import json
import os
import pyaudio
from websockets.asyncio.client import connect
class SimpleGeminiVoice:
def __init__(self):
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.22;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import {VRFConsumerBaseV2Plus} from "@chainlink/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Plus.sol";
import {VRFV2PlusClient} from "@chainlink/contracts/src/v0.8/vrf/dev/libraries/VRFV2PlusClient.sol";
@ssghost
ssghost / ai_reasoning_challenge_v2.md
Created October 12, 2024 10:59 — forked from VictorTaelin/ai_reasoning_challenge_v2.md
INVERT A BINARY TREE - $10k AI REASONING CHALLENGE (v2)

THE PROBLEM

🌲 Invert a binary tree! 🌲

Except with 3 catches:

  1. It must invert the keys ("bit-reversal permutation")
  2. It must be a dependency-free, pure recursive function
  3. It must have type Bit -> Tree -> Tree (i.e., a direct recursion with max 1 bit state)
# Description: comparison between FB Prophet and NeuralProphet
# Post: https://towardsdatascience.com/prophet-vs-neuralprophet-fc717ab7a9d8
# Author: Michael Berk
# Date created: 2022-12-08
import numpy as np
import pandas as pd
import plotly.express as px
import matplotlib.pyplot as plt