Skip to content

Instantly share code, notes, and snippets.

View fungos's full-sized avatar
🐀
.

Danny Angelo Carminati Grein fungos

🐀
.
View GitHub Profile
//
// Created by mfuntowicz on 3/28/23.
//
// ! Requires std=c++20
#include <span>
#include "safetensors.hpp"
#include "nlohmann/json.hpp"
namespace huggingface::safetensors {
@fungos
fungos / dump_core.rs
Created March 12, 2020 13:17 — forked from epilys/dump_core.rs
easy core dump on panic in rust for debugging
pub fn register_panic_handler() {
let default_panic = std::panic::take_hook();
std::panic::set_hook(Box::new(move |panic_info| {
default_panic(panic_info);
// Don't forget to enable core dumps on your shell with eg `ulimit -c unlimited`
let pid = std::process::id();
eprintln!("dumping core for pid {}", std::process::id());
@fungos
fungos / crawler.rs
Created March 2, 2020 18:21 — forked from rolisz/Cargo.toml
Simple web crawler in Rust
use rayon::prelude::*;
use reqwest::Url;
use select::document::Document;
use select::predicate::Name;
use select::predicate::Predicate;
use std::collections::HashSet;
use std::fs;
use std::io::Error as IoErr;
use std::io::Read;
use std::path::Path;
@fungos
fungos / nrr_ill.h
Created January 19, 2020 13:55 — forked from Reedbeta/nrr_ill.h
#pragma once
// Intrusive Linked List (or Internal Linked List, etc)
// by Nathan Reed, 2020-01-18. Licensed CC0 https://creativecommons.org/publicdomain/zero/1.0/
//
// Use it like:
//
// class MyClass
// {
// ...
#!/usr/bin/env sh
if test ! -d ./overlay; then
read -p "No overlay found here. Want to create one? (y/N)" yn
case $yn in
[Yy]* ) install -d overlay/upperdir && install -d overlay/workdir && install -d overlay/mnt; break;;
* ) exit;;
esac
fi
@fungos
fungos / CLA.md
Last active September 26, 2019 01:41

CrossUO Individual Contributor License Agreement

Thank you for your interest in contributing to CrossUO ("We" or "Us").

This contributor agreement ("Agreement") documents the rights granted by contributors to Us. To make this document effective, please sign it and send it to Us by electronic submission, following the instructions at . This is a legally binding document, so please read it carefully before agreeing to it. The Agreement may cover more than one software project managed by Us.

1. Definitions

"You" means the individual who Submits a Contribution to Us.

@fungos
fungos / tmux-cheatsheet.markdown
Created January 27, 2018 00:53 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@fungos
fungos / rust-env-setup.ps1
Last active June 15, 2018 13:43
A quickly hacked together Power Shell script to install and setup a complete Rust Development Environment.
function Download-Redirect-As
{
$uri = $args[0]
$target = $args[1]
Write-Host "Downloading $target..."
$request = Invoke-WebRequest -Uri $uri -MaximumRedirection 0 -ErrorAction Ignore
if ($request.StatusCode -ge 300 -and $request.StatusCode -lt 400)
{
$uri = $request.Headers.Location
}
#define ann_sigmoid(s) (1.0f / (1.0f + expf(-(s))))
#define ann_gaussian(s) (expf(-(s) * (s)))
#define ann_sin(s) (sinf(s))
#define ann_cos(s) (cosf(s))
#define ann_linear(s) (s)
#define ann_relu(s) ((s) < 0.0f ? FLT_EPSILON * (s) : (s))
#define ann_sigmoid_d(v) ((v) * (1.0f - (v)))
#define ann_gaussian_d(v, s) (-2.0f * (s) * v)
@fungos
fungos / ringbuffer.h
Created March 19, 2017 19:46 — forked from larsimmisch/ringbuffer.h
C++ implementation of a ringbuffer from @mrdk
// ringbuffer.h
// Author: Markus Redeker
#pragma warning(disable:4786)
#ifndef __RINGBUFFER_H__
#define __RINGBUFFER_H__
// Use:
// ringbuffer r;