This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request, jsonify, render_template_string | |
from transformers import AutoTokenizer, AutoModel | |
import numpy as np | |
import faiss | |
import torch | |
app = Flask(__name__) | |
# Initialize the model and tokenizer | |
model_name = 'bert-base-uncased' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call plug#begin(stdpath("data") . '/plugged') | |
Plug 'catppuccin/nvim', { 'as': 'catppuccin' } | |
Plug 'styled-components/vim-styled-components' | |
Plug 'brooth/far.vim' | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'folke/trouble.nvim' | |
Plug 'preservim/nerdcommenter' | |
Plug 'simrat39/rust-tools.nvim' | |
Plug 'luochen1990/rainbow' | |
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn print_iter<T>(iter: impl Iterator<Item = T>) | |
where | |
T: std::fmt::Debug, | |
{ | |
for i in iter { | |
println!("{:?}", i); | |
} | |
} | |
fn main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call plug#begin(stdpath("data") . '/plugged') | |
Plug 'catppuccin/nvim', { 'as': 'catppuccin' } | |
Plug 'styled-components/vim-styled-components' | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'folke/trouble.nvim' | |
Plug 'mengelbrecht/lightline-bufferline' | |
Plug 'preservim/nerdcommenter' | |
"Plug 'jiangmiao/auto-pairs' | |
Plug 'simrat39/rust-tools.nvim' | |
Plug 'luochen1990/rainbow' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![allow(unused)] | |
use serde::{Deserialize, Serialize}; | |
use std::str::FromStr; | |
use surrealdb::dbs::Response; | |
use surrealdb::dbs::Status; | |
use surrealdb::err::Error; | |
use surrealdb::opt::PatchOp; | |
use surrealdb::sql::{Thing, Value}; | |
#[derive(Debug, Deserialize, Serialize)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::env; | |
use serde::Serialize; | |
use surrealdb::engine::remote::ws::Ws; | |
use surrealdb::opt::auth::Root; | |
use surrealdb::Surreal; | |
#[derive(Debug, Serialize)] | |
struct Name<'a> { | |
first: &'a str, | |
last: &'a str, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use serde::{Deserialize, Serialize}; | |
use surrealdb::engine::remote::ws::Ws; | |
use surrealdb::opt::auth::Root; | |
use surrealdb::sql::Thing; | |
use surrealdb::Surreal; | |
#[derive(Debug, Serialize)] | |
struct Name<'a> { | |
first: &'a str, | |
last: &'a str, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' python3.10 hash_check.py -f inp.json ''' | |
from binascii import unhexlify | |
from hashlib import sha256 | |
import json | |
import sys | |
import urllib.request | |
# Convert into little endian format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
DIFFICULTY = 3 # Number of leading zeros required | |
def meets_difficulty(hash_string): | |
"""Checks if the hash string starts with the required number of zeros.""" | |
return hash_string.startswith("0" * DIFFICULTY) | |
def main(): | |
"""Hashes "Hello, World!" with varying nonces to find a valid hash.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// cargo add colored ! | |
use std::sync::{Arc, Mutex}; | |
use std::thread; | |
use colored::Colorize; | |
fn main() { | |
// Create a shared counter wrapped in an Arc and Mutex | |
let counter = Arc::new(Mutex::new(1)); | |
// Create a vector to hold the thread handles |
NewerOlder