Skip to content

Instantly share code, notes, and snippets.

@AtomKrieg
AtomKrieg / atf.py
Created November 22, 2022 17:53
read atf file (Adobe Texture Format) https://github.com/Gl0/atf2png
import gzip
import logging
from PIL import Image
class ATFFormat:
#JXRC_FMT_24bppRGB
ATFRGB888 = 0
#JXRC_FMT_32bppBGRA
ATFRGBA8888 = 1
#LZMA compressed DXT1 data + JXRC_FMT_16bppBGR565 + LZMA compressed PVRTC top data + LZMA compressed PVRTC bottom data + JXRC_FMT_16bppBGR555 + LZMA compressed ETC1 top data + LZMA compressed ETC1 bottom data + JXRC_FMT_16bppBGR555 + LZMA compressed ETC2Rgb top data + LZMA compressed ETC2Rgb bottom data + JXRC_FMT_24bppBGR
package utils
import java.lang.Integer.max
/*
| Symbol | Price | Change |
|--------|---------|--------|
| ABC | 20.85 | 1.626|
| DEF | 78.95 | 0.099|
| GHI | 23.45 | 0.192|
@AtomKrieg
AtomKrieg / gdc.py
Last active December 30, 2021 16:47
Grim Dawn Constellation - search for combinations of constellations that satisfy the requirements
import time
from functools import reduce
# Affinities = list[red, green, blue, yellow, purple]
class Constellation:
__slots__ = ('name', 'stars', 'requirement', 'bonus')
def __init__(self, name:str, stars:int, requirement, bonus):
self.name:str = name
self.stars:int = stars
@AtomKrieg
AtomKrieg / zcl_string_services.abap
Created September 18, 2018 16:52
zcl_string_services
class zcl_string_services definition create private final.
public section.
class-methods split_by_size
importing
text type clike
size type i default 50
limit type i default 4 " 0 - no limit
returning value(rt_string) type string_table.
@AtomKrieg
AtomKrieg / z_table_replacer.abap
Created September 18, 2018 13:44
z_table_replacer
report z_table_replacer.
parameters p_table type tabname matchcode object dd_tabl obligatory.
parameters p_field type fieldname obligatory.
types: begin of ts_change,
from type string,
to type string,
end of ts_change.
@AtomKrieg
AtomKrieg / xmldoc_to_string.abap
Created August 31, 2018 08:17
xmldoc_to_string
class-methods xmldoc_to_string
importing io_ixml_doc type ref to if_ixml_document
returning value(rv_string) type string.
method xmldoc_to_string.
data ixml type ref to if_ixml.
data factory type ref to if_ixml_stream_factory.
data ostream type ref to if_ixml_ostream.
data renderer type ref to if_ixml_renderer.
@AtomKrieg
AtomKrieg / Z_PROG_CHECK.abap
Last active April 7, 2020 20:35
package syntax check
function Z_PROG_CHECK.
*"----------------------------------------------------------------------
*"*"Локальный интерфейс:
*" IMPORTING
*" VALUE(TRDIR) TYPE TRDIR
*" EXPORTING
*" VALUE(SYNTAX_ERROR) TYPE FLAG
*"----------------------------------------------------------------------
data mess type string.
@AtomKrieg
AtomKrieg / dynpro_controller.abap
Created August 17, 2018 07:25
dynpro controller
report zrs.
class lcl_dynpro_controller definition deferred.
class lcl_app definition create private final.
public section.
class-methods new returning value(ro_instance) type ref to lcl_app.
methods run.
private section.
endclass.
@AtomKrieg
AtomKrieg / determine_variable_name.abap
Created August 15, 2018 17:41
determine_variable_name
report determine_variable_name.
class lcl_rtti definition final.
public section.
types: begin of ts_keyval,
key type string,
val type string,
end of ts_keyval.
types tt_keyval type standard table of ts_keyval with non-unique default key.
@AtomKrieg
AtomKrieg / show_any_table.abap
Last active December 12, 2018 09:41
salv helper
class lcl_debug definition create private final.
public section.
class-methods show_any_table importing it_any_table type any table.
endclass.
class lcl_debug implementation.
method show_any_table.
" -- transform type
field-symbols <lt> type standard table.
data tref type ref to data.