Skip to content

Instantly share code, notes, and snippets.

View aras-p's full-sized avatar

Aras Pranckevičius aras-p

View GitHub Profile
@aras-p
aras-p / hack.md
Created June 6, 2012 19:08
wordpress hack

1st time my blog got hacked:

Each page had embedded script code at the bottom that would once in a while try to redirect to a network of weird domain names. Found some modifications to most .php files in Wordpress that did a base64_decode on a long cryptic string. The underlying code was something quite clever, once in a while it would download actual php files to execute from a network of other servers, and would actually execute them sometimes. So I guess the actual payload would be changing whenever someone on those servers updated it.

2nd/3rd time my blog got hacked:

never saw the results myself, but some other folks said that my blog redirects somewhere, or displays some viagra ads. Probably something similar; e.g. wrong content would only be served once in a while? Modification was in wp-settings.php, that was also doing a base64_decode that actually evaluated to require_once (some file named Thumbs.db). That Thumbs.db actually contained a bunch of base64 encoded code that was doing similar things to

---
date: '2012-03-27 17:35:46'
layout: post
slug: tiled-forward-shading-links
status: publish
title: Tiled Forward Shading links
wordpress_id: '821'
comments: true
categories:
- gpu
@aras-p
aras-p / hullshaderbug.md
Created August 2, 2012 12:30
d3dcompiler_43.dll hull shader optimization bug

Hull shader constant function, in triangle domain:

HSConstData HS_FlatConstant(InputPatch<InterpData, 3> I)
{
    float3 f;
    // factors computed per vertex
    f.x = I[0].fact;
    f.y = I[1].fact;
    f.z = I[2].fact;
<None Include="D:\unity\graphics\artifacts\*_*_hlslang_1\Gen_hlslang.cpp" />
<None Include="D:\unity\graphics\artifacts\*_*_hlslang_1\hlslang_tab.cpp" />
<None Include="D:\unity\graphics\artifacts\*_*_hlslang_1\hlslang_tab.h" />
<None Include="D:\unity\graphics\artifacts\win32_*_hlslang_1\Gen_hlslang.cpp" />
<None Include="D:\unity\graphics\artifacts\win32_*_hlslang_1\hlslang_tab.cpp" />
<None Include="D:\unity\graphics\artifacts\win32_*_hlslang_1\hlslang_tab.h" />
<None Include="D:\unity\graphics\artifacts\win32_debug_hlslang_1\Gen_hlslang.cpp" />
<None Include="D:\unity\graphics\artifacts\win32_debug_hlslang_1\hlslang_tab.cpp" />
<None Include="D:\unity\graphics\artifacts\win32_debug_hlslang_1\hlslang_tab.h" />
<None Include="D:\unity\graphics\artifacts\win32_release_hlslang_1\Gen_hlslang.cpp" />
@aras-p
aras-p / gist:3952285
Created October 25, 2012 12:22
keywords
multi_compile A B C
multi_compile D E
A B C D E
+ . . + .
. + . + .
. . + + .
+ . . . +
. + . . +
. . + . +
Say asset has GUID 123456.
Right now, cached data is in Library/cache/123456 (skipping split into folders).
When asset changes, we reimport it (delete Library/cache/123456 I guess?).
With per-platform:
Cached data is in Library/cache/123456-ios (or whatever suffix to indicate "specific" bit)
When asset changes, delete Library/cache/123456-* (all cached files)
PROFIT!
// Macs with Radeon HD cards (2400-4850) have bugs when using depthstencil
// texture as both depth buffer for testing and reading as a texture. Happens
// at least on 10.5.8 to 10.6.4. Same happens on Radeon X1600 as well, so we
// just do the workaround for all Radeons.
//
// Also, 10.6.4 graphics driver update broke regular sampling of depth stencil
// textures. Some words from Apple's xxxx xxxxxxx:
// "What I suspect is happening is that ATI doesn't handle sampling from depth
// textures correctly if Hi-Z/Z-compression is on AND that texture has no
// mipmapping. I want to see if we can force the driver to alloc mipmaps for
CUSTOM_PROP String[] shaderKeywords {
const Material::ShaderKeywordsT& kw = self->GetShaderKeywords ();
const size_t count = kw.size();
ScriptingArrayPtr array = CreateScriptingArray<ScriptingStringPtr> (GetScriptingManager().GetCommonClasses().string, count);
for (int i = 0; i < count; ++i)
{
SetScriptingArrayElement<ScriptingStringPtr>(array,i,CreateScriptingString(kw[i]));
}
return array;
@aras-p
aras-p / gist:4162215
Created November 28, 2012 16:06
timer query fun
Q115: poll, got 0 m_Time 0 prev 0
Q127: poll, got 0 m_Time 0 prev 0
Q126: poll, got -4000 m_Time 0 prev 0
Q125: poll, got 0 m_Time 0 prev 0
Q124: poll, got -4000 m_Time 0 prev 0
Q123: poll, got 506240 m_Time 0 prev 0
Q122: poll, got 0 m_Time 0 prev 0
Q116: get elapsed, time 0
Q117: get elapsed, time -4160
Q118: get elapsed, time 0
@aras-p
aras-p / MobileIllumVertexLit.shader
Created November 30, 2012 13:23
Simple Illuminated VertexLit shader
Shader "Mobile/Illum VertexLit" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_Illum ("Illum (RGB)", 2D) = "black" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 80
Pass {