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 / 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 / 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;
#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 / 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)
@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 / 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 / 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
}