In VSCode, open the command palette with: Command + Shift + P
Then type: shell command
and choose install 'code' command in PATH
use candle_core::{Device, Tensor}; | |
fn main() -> Result<(), Box<dyn std::error::Error>> { | |
let device = Device::new_metal(0)?; | |
let a = Tensor::randn(0f32, 1., (2, 3), &device)?; | |
let b = Tensor::randn(0f32, 1., (3, 4), &device)?; | |
let c = a.matmul(&b)?; | |
println!("{c}"); |
use ndarray::prelude::*; | |
use ndarray::Array; | |
use ndarray::{concatenate, stack, Axis}; | |
use std::f64::INFINITY as inf; | |
fn main() { | |
let a = array![[10.,20.,30.,40.,]]; | |
// [[10., 20., 30., 40.]] | |
println!("a {:?}", &a); | |
// [1, 4] |
use candle_core::{Device, Result, Tensor}; | |
//use candle_nn; | |
use image; | |
use std::collections::HashSet; | |
const CPUNKS_PATH: &str = "../cpunks-10k/cpunks/images/training/"; | |
const CPUNKS_TOTAL: u16 = 10000; | |
pub fn get_punk_tensor(p_id: u16) -> Result<(Tensor, usize, usize)> { | |
let path = format!("{}punk{:0>4}.png", CPUNKS_PATH, p_id); |
use tokio; | |
use reqwest; | |
use serde::{Deserialize, Serialize}; | |
#[derive(Serialize, Deserialize, Debug)] | |
struct Account { | |
username: String | |
} | |
#[derive(Serialize, Deserialize, Debug)] |
use candle_core::{Device, Result, Tensor}; | |
use image; | |
pub fn hongry<P: AsRef<std::path::Path>>( | |
p: P, | |
) -> Result<(Tensor, usize, usize)> { | |
let img = image::open(p).unwrap(); | |
let (height, width) = (img.height() as usize, img.width() as usize); | |
let img = img.to_rgba8(); | |
let data = img.into_raw(); |
# Only two requirements | |
# - openai | |
# - python-dotenv | |
# | |
# Assumes you have $OPENAI_API_KEY in your environment or it is defined | |
# in a .env file | |
# | |
# Usage: | |
# | |
# $ nopilot hello world in erlang |
#!/usr/bin/env python | |
# $ python ./scripts/diffgit.py nb/AddLabelsToVAE.ipynb | |
# 8a9 | |
# > print('hey') | |
import sys | |
import shlex | |
import subprocess | |
import tempfile |
use async_ssh2_tokio::{ | |
Error, | |
client::AuthMethod | |
}; | |
mod pools; | |
#[tokio::main] | |
async fn main() -> Result<(), Error> { |
// Here is the output for this gist | |
// | |
// Ok(Client { username: "beez", address: 192.168.122.89:22, connection_handle: "Handle<ClientHandler>" }) | |
// Ok(Client { username: "beez", address: 192.168.122.204:22, connection_handle: "Handle<ClientHandler>" }) | |
// killa-a2 | |
// killa-a1 | |
// killa-a2 | |
// killa-a1 | |
// killa-a1 | |
// killa-a2 |