This file contains 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
#pragma once | |
constexpr size_t DxgiFormatRowSize(DXGI_FORMAT format, uint width) | |
{ | |
switch (format) | |
{ | |
case DXGI_FORMAT_R32G32B32A32_TYPELESS: | |
case DXGI_FORMAT_R32G32B32A32_FLOAT: | |
case DXGI_FORMAT_R32G32B32A32_UINT: | |
case DXGI_FORMAT_R32G32B32A32_SINT: |
This file contains 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
/* | |
A BC5 normal map texture visualization shader for RenderDoc. | |
Usage: | |
1. Save this to %APPDATA%/qrenderdoc/ on Windows or ~/.local/share/qrenderdoc elsewhere | |
2. Set Channels mode to Custom in RenderDoc Texture Viewer | |
3. Select the shader from the dropdown menu | |
*/ | |
SamplerState pointSampler : register(s0); | |
Texture2DArray<float4> texDisplayTex2DArray : register(t2); |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>MANDELBROT</title> | |
</head> | |
<body style="font-family: sans-serif;"> |
This file contains 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
qApp->setStyle(QStyleFactory::create("Fusion")); | |
QPalette darkPalette; | |
darkPalette.setColor(QPalette::Window, QColor(53,53,53)); | |
darkPalette.setColor(QPalette::WindowText, Qt::white); | |
darkPalette.setColor(QPalette::Base, QColor(25,25,25)); | |
darkPalette.setColor(QPalette::AlternateBase, QColor(53,53,53)); | |
darkPalette.setColor(QPalette::ToolTipBase, Qt::white); | |
darkPalette.setColor(QPalette::ToolTipText, Qt::white); | |
darkPalette.setColor(QPalette::Text, Qt::white); |
This file contains 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
import sys | |
count=0 | |
sys.setrecursionlimit(50000) | |
cache={} | |
def a(m,n): | |
global count | |
global cache | |
count=count+1 | |
if cache.has_key(m) and cache[m].has_key(n): | |
return cache[m][n] |
This file contains 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
// Assume we need 32-byte alignment for AVX instructions | |
#define ALIGN 32 | |
void *aligned_malloc(int size) | |
{ | |
// We require whatever user asked for PLUS space for a pointer | |
// PLUS space to align pointer as per alignment requirement | |
void *mem = malloc(size + sizeof(void*) + (ALIGN - 1)); | |
// Location that we will return to user |
This file contains 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
from math import log | |
k = int(input("Kelvin: "))//100 | |
(r,g,b) = (0,0,0) | |
# RED: | |
if k <= 66: | |
r=255 |
This file contains 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
HDC hdc = GetDC(NULL); // get the desktop device context | |
HDC hDest = CreateCompatibleDC(hdc); // create a device context to use yourself | |
// get the height and width of the screen | |
int height = GetSystemMetrics(SM_CYVIRTUALSCREEN); | |
int width = GetSystemMetrics(SM_CXVIRTUALSCREEN); | |
// create a bitmap | |
HBITMAP hbDesktop = CreateCompatibleBitmap( hdc, width, height); |
This file contains 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
from typing import List | |
from random import randint | |
import timeit | |
def simple_search(haystack: List[int], needle: int): | |
for idx, i in enumerate(haystack): | |
if i == needle: | |
return idx |
This file contains 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
// source: https://web.archive.org/web/20190809011021/https://stackoverflow.com/questions/38730273/how-to-limit-fps-in-a-loop-with-c | |
// cody by HolyBlackCat | |
#include <iostream> | |
#include <cstdio> | |
#include <chrono> | |
#include <thread> | |
std::chrono::system_clock::time_point a = std::chrono::system_clock::now(); | |
std::chrono::system_clock::time_point b = std::chrono::system_clock::now(); |