Skip to content

Instantly share code, notes, and snippets.

skeeet /
Created June 12, 2024 09:09 — forked from AndreVallestero/
Fast, real-time gaze tracker using mediapipe and python (faster than dlib or openface)
import cv2 as cv
import numpy as np
from mediapipe import solutions
LEFT_IRIS = [pair[0] for pair in solutions.face_mesh.FACEMESH_LEFT_IRIS]
RIGHT_IRIS = [pair[0] for pair in solutions.face_mesh.FACEMESH_RIGHT_IRIS]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
skeeet /
Created November 21, 2022 23:01 — forked from Narsil/
Loading a safetensors file with pure torch only
import mmap
import torch
import json
import os
from huggingface_hub import hf_hub_download
def load_file(filename, device):
with open(filename, mode="r", encoding="utf8") as file_obj:
with mmap.mmap(file_obj.fileno(), length=0, access=mmap.ACCESS_READ) as m:
skeeet /
Created November 27, 2020 20:16 — forked from alper111/
PyTorch implementation of Laplacian pyramid loss
import torch
def gauss_kernel(size=5, device=torch.device('cpu'), channels=3):
kernel = torch.tensor([[1., 4., 6., 4., 1],
[4., 16., 24., 16., 4.],
[6., 24., 36., 24., 6.],
[4., 16., 24., 16., 4.],
[1., 4., 6., 4., 1.]])
kernel /= 256.
kernel = kernel.repeat(channels, 1, 1, 1)
skeeet / mlSpeedTests.swift
Created May 19, 2020 09:40 — forked from akirasosa/mlSpeedTests.swift
Benchmark Core ML model in iOS.
import CoreML
import XCTest
@testable import mlsample
class mlsampleTests: XCTestCase {
override func setUp() {
skeeet /
Created April 27, 2020 01:05 — forked from smoser/
Boot a specific installed Ubuntu kernel using grub-reboot and grub-set-default

Ubuntu Grub Boot Kernel

Boot a specific installed Ubuntu kernel using grub-reboot and grub-set-default.

This allows you to pick what kernel you want to boot on next reboot, or set the default, without having to know much about how grub works or editing config files.


  Usage: boot-kernel [options] [kernel]

call grub-reboot or grub-set-default to boot the provided kernel.

skeeet / .tmux.conf
Created November 3, 2019 05:07 — forked from paulodeleo/.tmux.conf
Tmux configuration to enable mouse scroll and mouse panel select, taken from:
# Make mouse useful in copy mode
setw -g mode-mouse on
# Allow mouse to select which pane to use
set -g mouse-select-pane on
# Allow mouse dragging to resize panes
set -g mouse-resize-pane on
# Allow mouse to select windows
skeeet / CMakeLists.txt
Created April 1, 2019 22:27 — forked from zeryx/CMakeLists.txt
minimal pytorch 1.0 pytorch -> C++ full example demo image at:
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
set(CMAKE_PREFIX_PATH ../libtorch)
find_package(Torch REQUIRED)
find_package(OpenCV REQUIRED)
add_executable(testing main.cpp)
message(STATUS "OpenCV library status:")
message(STATUS " config: ${OpenCV_DIR}")
skeeet /
Created February 20, 2019 11:31 — forked from stormraiser/
Danbooru Faces dataset

Danbooru Faces v0.1


This dataset contains ~443k anime face images of size 256x256 drawn by ~7,000 artists, obtained from Danbooru


We first downloaded JSON files of all existing posts numbered from 1 to 2,800,000 using their API. We filtered the posts by the following criteria:

skeeet /
Created February 20, 2019 10:41 — forked from MFreidank/
A pytorch DataLoader that generates an unbounded/infinite number of minibatches from the dataset.
from import DataLoader
class InfiniteDataLoader(DataLoader):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Initialize an iterator over the dataset.
self.dataset_iterator = super().__iter__()
def __iter__(self):