Skip to content

Instantly share code, notes, and snippets.

from flask import Flask, request, send_file
import torch
from diffusers import FluxPipeline
from io import BytesIO
import ssl
import os
app = Flask(__name__)
# Initialize the pipeline
package main
import (
"bytes"
"fmt"
"html/template"
"io/ioutil"
"log"
"os"
"path/filepath"
@d0rc
d0rc / sos-id.go
Created September 12, 2024 10:00
package main
import (
"crypto/md5"
"encoding/hex"
"flag"
"fmt"
"io/ioutil"
"path/filepath"
"sort"
**Disclaimer**: This is an incredibly simplified description of the process; some statements may exaggerate or distort certain aspects for illustrative purposes. The mentioned mathematical guarantees might vary in strength, from absolute impossibility to computational complexity, but these simplifications aim to convey the core idea clearly.
Asymmetric Encryption: A clever cryptographic method where you have two keys with distinct roles - one locks (encrypts) data, and the other unlocks (decrypts) it. Think of these keys as numbers linked by special mathematical rules, generated together yet serving different purposes. One key, known as the private key, remains your closely guarded secret; it's used to decrypt your confidential data. On the other hand, the public key is like a lock that many people can use to insert messages but only unlocks with your private key. You safely share this public key far and wide because it doesn't reveal anything about your private key. Anyone wanting to send you a secure messa
@d0rc
d0rc / embeddings-test.py
Created December 22, 2023 16:48
embedding space
import torch
from torch import nn
from tqdm import tqdm
import pandas as pd
from torch.utils.data import Dataset, DataLoader
import torch.nn.functional as F
device = 'cpu'
# Custom Dataset
mvn install -DskipTests=true -Dgpg.skip=true
@d0rc
d0rc / options_generator.ex
Created June 22, 2014 22:53
options_generator.ex
defmodule Options do
@proto_version "1.0"
def process_options(opts) do
log_opt ++
Enum.map(opts, fn
{:in, true} -> ["-in"]
{:err, :out} -> ["-err", "out"]
{:err, :err} -> ["-err", "err"]
{:dir, dir} -> ["-dir", dir]
@d0rc
d0rc / piper.ex
Created May 7, 2014 09:07
pipes pipes pipes
defmodule PipesX do
defmacro pipe_with(fun, pipes) do
IO.puts "Will reduce over: #{inspect Macro.unpipe(pipes)}"
Enum.reduce Macro.unpipe(pipes), &(reduce_with &1, &2, fun)
end
defp reduce_with( {segment, pos}, acc, outer ) do
IO.puts "reduce_with: Got #{inspect segment} at #{inspect pos}"
quote do
inner = fn(x) ->
@d0rc
d0rc / laxer.ex
Created April 24, 2014 12:13
ListDict is dead, long live the ListDict (deflamodule)
defmodule LAXer do
defmodule Transformer do
def exec({ {:., _, [Kernel, :access]} , _, [subj, [key]]}) do
quote do
LAXer.getter(unquote(exec(subj)), unquote(exec(key)))
end
end
def exec({ op, misc, args }) when is_list(args) do
{op, misc, (for arg <- args, do: exec(arg))}
end
@d0rc
d0rc / lax.ex
Created April 24, 2014 02:33
ListDict is dead, long live the ListDict
defmodule LAX do
defmodule Transformer do
def exec({ {:., _, [Kernel, :access]} , misc, [subj, [key]]}) do
quote do
LAX.getter(unquote(exec(subj)), unquote(exec(key)))
end
end
def exec(code), do: code
end