Skip to content

Instantly share code, notes, and snippets.

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

Denis Nuțiu dnutiu

🏠
Working from home
View GitHub Profile
import Foundation
import Vision
print("Hello, World!")
let imagePath = "/Users/dnutiu/Pictures/Jul 15 2023/540A6766.jpg"
let config = MLModelConfiguration()
let imageTagger = try resnet151(configuration: config)
import torch
import torchvision.transforms as transforms
model_path = "models/resnet18_5_epochs.pth"
model = torch.load(model_path, map_location=torch.device('cpu'))
model.eval()
# transform image to tensor
transform = transforms.Compose([

The function:

@lru_cache()
def movie_repository(settings: Settings = Depends(settings_instance)):
    """
    Movie repository instance to be used as a Fast API dependency.
    """
    return MongoMovieRepository(
 connection_string=settings.mongo_connection_string,
var makeCRCTable = function(){
var c;
var crcTable = [];
for(var n =0; n < 256; n++){
c = n;
for(var k =0; k < 8; k++){
c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
}
crcTable[n] = c;
}
@dnutiu
dnutiu / rust_simd.rs
Created March 25, 2023 10:15
Rust SIMD example; Requires nightly build and rand = "0.8.5" dependency.
#![feature(portable_simd)]
#![feature(test)]
use std::simd::{i32x16, Simd, SimdPartialEq, ToBitMask};
use rand::Rng;
#[inline(never)]
fn hamming_distance_simd(a: &mut Vec<i32>, b: &mut Vec<i32>) -> u32 {
let mut distance: u32 = 0;
let lanes = 16;
@dnutiu
dnutiu / fibonaci.rs
Created March 21, 2023 19:59
An iterative & recursive implementation of Fibbonaci in Rust.
fn fib(n: i32) {
let mut a: u128 = 1;
let mut b = 1;
for i in 0..n {
if i == 0 || i == 1{
print!("{} ", a);
continue
}
let c = a;
@dnutiu
dnutiu / combine-video.sh
Created January 15, 2023 19:05
Separate Audio from Video (with ffmpeg)
filename=`echo "$1" | awk '{gsub(/.*[/]|[.].*/, "", $0)} 1'`
ffmpeg -i "./${filename}Temp.mp4" -i "./${filename}Temp.wav" -c:v copy -c:a aac "./${filename}Final.mp4"
rm "./${filename}Temp.m4a"
rm "./${filename}Temp.mp4"
@dnutiu
dnutiu / fusuma_config.yml
Last active May 3, 2020 18:23
Fusuma trackpad gestures
# sudo gpasswd -a $USER input
# sudo apt-get install libinput-tools
# sudo apt-get install xdotool
# sudo apt install ruby
# sudo gem install fusuma
# nano ~/.config/fusuma/config.yml
swipe:
3:
left:
command: 'xdotool key ctrl+alt+Up'
@dnutiu
dnutiu / AdbCommands
Created April 29, 2020 13:01 — forked from berkedel/AdbCommands
Adb useful commands list
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
== Shell
### Keybase proof
I hereby claim:
* I am dnutiu on github.
* I am denisnutiu (https://keybase.io/denisnutiu) on keybase.
* I have a public key ASDzEkyeLbX1bNuVbCuz8d39CzRt4k6k1gtZThgr71QK0go
To claim this, I am signing this object: