Skip to content

Instantly share code, notes, and snippets.

View TACIXAT's full-sized avatar
🌴
Good life

TACIXAT TACIXAT

🌴
Good life
View GitHub Profile
@TACIXAT
TACIXAT / halftone.py
Created July 16, 2024 11:03
Python implementation for converting images to halftone
import cv2
import drawsvg
import argparse
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image, ImageDraw
def show_raster(im):
im = cv2.cvtColor(im, cv2.COLOR_GRAY2RGB)
plt.figure()
@TACIXAT
TACIXAT / dl-quickstart.md
Created November 19, 2023 16:38
Deep Learning "Quick" Start

Deep Learning "Quick" Start

Positioning - The industry is extremely young. Not a lot of companies are hiring for these things right now. If you can't find work right now in these areas, network and position yourself as the person who does the thing. When someone needs the thing, they will come talk to you.

Innovation - The industry is so young and there is a ton of opportunity. Training a model is not particularly difficult. Apply these tools seriously in your domain.

Intro Courses

I would recommend trying both of these and choosing one. Two different approaches that work for different people.

@TACIXAT
TACIXAT / open_clip_benchmarks.md
Last active August 3, 2024 12:48
Throughput benchmarks for all OpenCLIP models

OpenCLIP Throughput Benchmark (image embeddings per second)

This should give an idea of relative throughput of the models. I could not discern what would be fastest from the names alone.

This is just a speed test. Obviously the larger models will perform better on evaluation benchmarks at the tradeoff of speed. Find the models that meet your throughput requirements then benchmark those for performance on the task you are doing.

Tested on an NVIDIA RTX 3090. CPU is an AMD 7950x, though that should not affect the benchmark much.

Code

@TACIXAT
TACIXAT / fmt-sexp.py
Last active September 18, 2024 13:44
Format Python Tree Sitter S-Expression
"""Formats an sexpression for pretty printing."""
def format_sexpression(s, indent_level=0, indent_size=4):
"""ChatGPT + TACIXAT"""
output = ""
i = 0
# Initialize to False to avoid newline for the first token
need_newline = False
cdepth = [] # Track colons
while i < len(s):
@TACIXAT
TACIXAT / cutout.py
Last active July 17, 2024 22:47
Python OpenCV command line implementation for Photoshop's Cutout Filter
import cv2
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
import numpy as np
import random
import argparse
# big thanks to this answer for the sketch
# https://stackoverflow.com/a/63647647/1176872
@TACIXAT
TACIXAT / checker.go
Last active May 23, 2022 05:45
Golang Application Specific Static Analysis - Checks if a funtion calls mismatched error functions
package main
import (
"flag"
"fmt"
"go/ast"
"go/parser"
"go/token"
"log"
)
@TACIXAT
TACIXAT / cloudflare.go
Created February 11, 2022 05:33
Golang Cloudflare Images Boilerplate Code
package main
import (
"bytes"
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"encoding/json"
// "mime/multipart"
"errors"
@TACIXAT
TACIXAT / main.go
Created September 6, 2021 00:07
babuk nas decryptor
package main
import (
"fmt"
"os"
"path/filepath"
"strings"
"crypto/sha256"
@TACIXAT
TACIXAT / main.go
Created September 6, 2021 00:06
babuk nas encryptor
package main
import (
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"runtime"
"strings"
@TACIXAT
TACIXAT / stat_offsets.c
Created August 10, 2021 18:57
print values, offsets, sizes for members of struct stat
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
void
fstat_filesize(const char *filename)
{
int fd;