Skip to content

Instantly share code, notes, and snippets.

View abesmon's full-sized avatar
🎱
SHIT ==> GOLD

Alexey Lysenko abesmon

🎱
SHIT ==> GOLD
View GitHub Profile
@abesmon
abesmon / image_uploader.py
Created May 12, 2025 09:51
# Image Uploader Скрипт для загрузки изображений на ImgBB и FreeImage. Использует только стандартную библиотеку Python. ## Использование ```bash python image_uploader.py путь_к_изображению --service [imgbb|freeimage] [--expiration время_в_секундах] ``` Требуется файл `.env` с API ключами: ```env IMG_BB_API_KEY=ваш_ключ FREEIMAGE_API_KEY=ваш_ключ…
import os
import base64
import json
import urllib.request
import urllib.parse
import urllib.error
import argparse
import logging
from pathlib import Path
from typing import Optional, Dict, Any
@abesmon
abesmon / SliderSUI.swift
Created November 27, 2024 14:27
Some simple slider with scaling effect and auto paging
//: [Previous](@previous)
import SwiftUI
import PlaygroundSupport
struct SliderView: View {
@State private var containerWidth: CGFloat = 0
private var leadingOffset: CGFloat {
(containerWidth - (containerWidth * normalScale)) / 2
}
@abesmon
abesmon / UIColorHexString.swift
Created May 18, 2022 17:40
property wrapper for codable color hex string
import UIKit
@propertyWrapper
struct UIColorHexString: Codable {
private var stringValue: String
var wrappedValue: UIColor {
get { UIColor(hexString: stringValue) }
set { stringValue = newValue.hexString }
}
@abesmon
abesmon / CodableEnum.swift
Last active May 18, 2022 17:39
codable property wrapper
import UIKit
@propertyWrapper
struct CodableEnum<T: RawRepresentable>: Codable where T.RawValue: Codable {
private var value: T.RawValue
var wrappedValue: T {
get { T(rawValue: value)! }
set { value = newValue.rawValue }
}
@abesmon
abesmon / now.py
Last active September 21, 2021 13:33
for epoch in range(num_epochs):
for n, (real_samples, _) in enumerate(train_loader):
# Обучение дискриминатора
optimizer_discriminator.zero_grad()
# Данные для тренировки дискриминатора
real_samples = real_samples.to(device=device)
real_samples_labels = torch.ones((batch_size, 1)).to(device=device)
real_outp = discriminator(real_samples)
#Created by: Adobe Photoshop Export Color Lookup Plugin
#Copyright: (C) Copyright 2017 RocketStock
TITLE "Sepia"
#LUT size
LUT_3D_SIZE 32
#data domain
DOMAIN_MIN 0.0 0.0 0.0
DOMAIN_MAX 1.0 1.0 1.0
@abesmon
abesmon / FakeLiquid.frag
Last active April 28, 2021 08:10
Fake Liquid shader made in GLSL to run in TouchDesigner. Though, can be ported painlessly to any other engines/languages :) It also supports shaking, but some external script should provide wobble angles :)
uniform vec3 uLine;
uniform vec4 uLiquidColor;
uniform float uLineHeight;
uniform float uFrenelPow;
in Vert {
vec3 objectPoint;
vec3 normalForCam;
} iVert;
@abesmon
abesmon / interiorMapping.frag
Created February 22, 2021 17:09
Interior mapping made for TouchDesigner in GLSL
// Example Vertex Shader
out v2f {
flat int cameraIndex;
vec3 p;
vec4 pos;
vec2 uv;
mat3 tbn;
} oVert;
@abesmon
abesmon / virtualSDF.frag
Created February 21, 2021 21:37
SDF but that is calculated to the origin of mesh. It can be used to create virtual space with different sdf shaped inside of any mesh
uniform float uTime;
uniform sampler2D frontTex;
in v2f {
flat int cameraIndex;
vec4 pos;
vec3 originalP;
vec2 uv;
mat3 tbn;
@abesmon
abesmon / parallax.frag
Last active May 21, 2021 20:16
Пример того, как с помощью шейдера можно создать ощущение объема. Шейдер написан для работы с TouchDesigner, но в нем нет ничего такого, что было-бы невозможно адаптировать под другое окружение :) пример: https://www.instagram.com/p/CLh7OsCiSPc/
uniform vec3 heights;
uniform sampler2D texLayerOne;
uniform sampler2D texLayerTwo;
uniform sampler2D texLayerThree;
uniform sampler2D frontTex;
in v2f {
flat int cameraIndex;
vec4 pos;