Skip to content

Instantly share code, notes, and snippets.

#include <type_traits>
#include <cstdio>
template<unsigned N>
struct priority_tag : priority_tag<N-1> {};
template<> struct priority_tag<0> {};
struct sfinae {
template<typename t> static std::enable_if_t<sizeof(t) >= 4> op(t, priority_tag<2> = {}) { printf("foo4\n"); }
template<typename t> static std::enable_if_t<sizeof(t) >= 2> op(t, priority_tag<1> = {}) { printf("foo2\n"); }
template<typename t> static void op(t, priority_tag<0> = {}) { printf("foo1\n"); }
@sthalik
sthalik / module-mass.csv
Created January 29, 2022 19:21
Highfleet part mass by Radiant Dawn
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
m_oid,m_density,m_mesh,m_mass
CROWD_SALUTE_01,0.0,"{
m_classname=Mesh
m_size=4
1.46429
-3.60725
1.75006
3.03582
-1.75006
2.89294
@sthalik
sthalik / build.txt
Created December 21, 2019 16:36
appveyor ci for opentrack
set -e
git submodule update --init
mkdir build; cd build
git clone --depth 1 --recurse-submodules --shallow-submodules \
https://github.com/opentrack/opentrack-depends deps
mkdep deps/aruco -DCMAKE_CXX_FLAGS="-w -O3"
@sthalik
sthalik / doc.md
Last active June 12, 2018 12:13
Perceptual artifact metrics for S3TC compression of various sprites in Factorio

Intro

Measures perceptual artifacts for S3TC-compressed Factorio sprites, see <https://forums.factorio.com/viewtopic.php?f=6&t=60909>.

Flaws in methodology used

The SSIM/DSSIM metrics used here don't take edges into account. They should assign different weights to edge/gradient/flat areas. Typical weights for edge/gradient/flat areas are 1/.25/.25, respectively. The methodology used in this document disregards that completely. Author didn't bother doing edge detection and masking.

Results provided here are for DXT5 only, change the shell variable s3tc_variant below to generate for DXT3.

@sthalik
sthalik / discord-tray.diff
Created November 8, 2017 12:46
start Discord in tray
--- index.js 2017-11-08 10:48:35.923490562 +0100
+++ ../b/index.js 2017-11-08 13:33:02.474318130 +0100
@@ -630,7 +630,7 @@
return launchMainAppWindow(false);
});
splashWindow.once(_SplashWindow2.default.EVENT_APP_SHOULD_SHOW, function () {
- return setWindowVisible(false);
+ return setWindowVisible(true);
});
}, function (args) {
def get_appdata_local_path():
from os import getenv
def get_1():
path = getenv("APPDATA")
if path:
return path + "/../Local"
def get_2():
path = getenv("USERPROFILE")
if path:
if has("win32unix") && !v:vim_did_enter
function! s:fixup_filename()
let old_swapfile = &swapfile
let name = substitute(@%, "\\\\", "/", "g")
exe 'file' fnameescape(name)
setlocal noswapfile
exe 'e' fnameescape(name)
if old_swapfile
setlocal swapfile
end
/*
_____________________
LumaSharpen 1.4.1
_____________________
by Christian Cann Schuldt Jensen ~ CeeJay.dk
It blurs the original pixel with the surrounding pixels and then subtracts this blur to sharpen the image.
It does this in luma to avoid color artifacts and allows limiting the maximum sharpning to avoid or lessen halo artifacts.
account:subscribe_mailbox('INBOX')
account:subscribe_mailbox('Junk')
E_JUNK = 'imapfilter-junk'
E_SEEN = 'imapfilter-seen'
E_SZ = 1024 * 512
update = false
repeat
new_sz = account.INBOX:is_smaller(E_SZ)
diff --git a/src/gallium/state_trackers/nine/basetexture9.c b/src/gallium/state_trackers/nine/basetexture9.c
index 12da1e0..51bb2a6 100644
--- a/src/gallium/state_trackers/nine/basetexture9.c
+++ b/src/gallium/state_trackers/nine/basetexture9.c
@@ -452,8 +452,9 @@ NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This,
if (unlikely(This->format == D3DFMT_NULL))
return D3D_OK;
NineBaseTexture9_Dump(This);
+ NineBaseTexture9_CreatePipeResource(This, true);
}