This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------------------------------ | |
Memory Allocator perfomance benchmark | |
------------------------------------------------------------------------ | |
local_n = n threads allocating and deallocating random blocks of max | |
size. Deallocations always happening in the same thread that | |
the corresponding allocation. | |
share_n = n threads allocating and deallocating random blocks of max | |
size from a shared list. Deallocation may happen in different | |
thread that the allocation one |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Made this code to change to fullscreen, useful if you're creating a DX application in vs2015/c++/uwp | |
// Also look at this sample: https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/FullScreenMode/cpp | |
// And this MSDN page: https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.viewmanagement.applicationview.preferredlaunchwindowingmode?cs-save-lang=1&cs-lang=cpp#code-snippet-1 | |
// preferred mode in constructor | |
App::App() | |
{ | |
// starts with this window size | |
Windows::UI::ViewManagement::ApplicationView::PreferredLaunchViewSize= Windows::Foundation::Size(800,600); | |
Windows::UI::ViewManagement::ApplicationView::PreferredLaunchWindowingMode = Windows::UI::ViewManagement::ApplicationViewWindowingMode::PreferredLaunchViewSize; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Check SSE/AVX support. | |
This application can detect the instruction support of | |
SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4a, SSE5, and AVX. | |
*/ | |
#include <iostream> | |
#ifdef _MSC_VER | |
#include <intrin.h> | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rectSAT(r0,r1): | |
'''Returns a tuple with 1st as axis with bigger distance (0=x,1=y) | |
and 2nd as the bigger separating distance. | |
If tuple[1]<0 there's penetration. If tuple[1]>0 no penetration. | |
Assumes Y grows down the screen.''' | |
# vertical edges | |
if r0.left > r1.left: r0,r1 = r1,r0 # assume r0 is always on left | |
sepX = r1.left - r0.right | |
if r0.top > r1.top: r0,r1=r1,r0 # assume r0 is always on top | |
sepY = r1.top - r0.bottom |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This program downloads all tickets from Parature using Parature SDK you can find here: | |
// https://github.com/Parature/ParatureSDK | |
// Create a c# project like the Parature SDK - Exercises.csproj and put this code. | |
// You must fill your credentials in the .config file | |
// It will create a folder for every ticket that will contain the text with details in html format | |
// and the attachment files. | |
// It also will create a table of content for all downloaded tickets. | |
// To build, download the ParatureSDK and override one of the examples with this program. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// recursive variadic template hash | |
// base case | |
template<typename T> | |
std::size_t makeHash(const T& v) | |
{ | |
return std::hash<T>()(v); | |
} | |
// recursive variadic template hash | |
template<typename T, typename... Args> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <netinet/tcp.h> | |
#include <sys/socket.h> | |
#include <sys/types.h> | |
#include <netinet/in.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ----------------------------------------------------------------- | |
// Enumerate all objects in this category, printing the name | |
// ----------------------------------------------------------------- | |
void enum_cat(REFGUID cat) | |
{ | |
HRESULT hr; | |
ICreateDevEnum *pSysDevEnum = NULL; | |
IEnumMoniker *pEnum = NULL; | |
IMoniker *pMoniker = NULL; | |
VARIANT var; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Inspects header of the image file and returns the width, height, depth and size in bytes | |
Suppoted formats: dds, sgi rgb, jpg, png, tga, bmp | |
You have to provide the implementation for: | |
* _swap16/32: Is a byte order swap for little endian platforms, because most of the formats are in network order (big endian). | |
* ExtensionIs: Returns true if the filename has the passed extension | |
Note: For the DDS format, if the depth is negative, then it specifies the compression format. -1 for DXT1, -2 for DXT2 and so on. | |
Note: ImgAttr might be removed and passing width/height/depth/size as out parameters of the function. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ID3D11Debug* pDebug=NULL; | |
HRESULT hr=m_pDevice->QueryInterface(__uuidof(ID3D11Debug), (void**)&pDebug); | |
m_pDevice->Release(); // report after device release (?) | |
if (SUCEEDED(hr)) | |
{ | |
pDebug->ReportLiveDeviceObjects(D3D11_RLDO_DETAIL); | |
} |