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
| from math import log | |
| k = int(input("Kelvin: "))//100 | |
| (r,g,b) = (0,0,0) | |
| # RED: | |
| if k <= 66: | |
| r=255 |
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
| 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 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
| 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 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
| // 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(); |
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
| #if defined(_MSC_VER) | |
| _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF); | |
| _CrtSetReportMode(_CRT_ASSERT,_CRTDBG_MODE_FILE); | |
| _CrtSetReportFile(_CRT_ASSERT,_CRTDBG_FILE_STDERR); | |
| #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
| // InstructionSet.cpp | |
| // Compile by using: cl /EHsc /W4 InstructionSet.cpp | |
| // processor: x86, x64 | |
| // Uses the __cpuid intrinsic to get information about | |
| // CPU extended instruction set support. | |
| #include <iostream> | |
| #include <vector> | |
| #include <bitset> | |
| #include <array> |
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 <stdlib.h> // atoll | |
| #include <stdint.h> // uint64_t | |
| #include <inttypes.h> // PRIu64 | |
| static const char *humanSize(uint64_t bytes) | |
| { | |
| char *suffix[] = {"B", "KB", "MB", "GB", "TB"}; | |
| char length = sizeof(suffix) / sizeof(suffix[0]); |
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
| bool GoFullscreen() | |
| { | |
| // turn off window region without redraw | |
| SetWindowRgn(m_hWindow, 0, false); | |
| DEVMODE newSettings; | |
| // request current screen settings | |
| EnumDisplaySettings(0, 0, &newSettings); |
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
| // Copyright (c) 2019 Antinomy Interactive. All rights reserved. | |
| // PURPOSE: Check for DXR support | |
| // AUTHOR: Andrey Tsurkan (andrey.turcan@hotmail.com) | |
| #include <iostream> | |
| #include <sstream> | |
| #include <string> | |
| #include <windows.h> | |
| #include <dxgi.h> | |
| #include <d3d12.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
| inline bool IsDirectXRaytracingSupported(IDXGIAdapter1* adapter) | |
| { | |
| ComPtr<ID3D12Device> testDevice; | |
| D3D12_FEATURE_DATA_D3D12_OPTIONS5 featureSupportData = {}; | |
| // create Direct3D 12 device with 11.0 FL | |
| // IID_PPV_ARGS automatically computes interface ID (REFIID that equals to IID_ID3D12Device) | |
| // and the pointer and passes them as two comma-separated arguments | |
| return SUCCEEDED(D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&testDevice))) | |
| // check support for OPTIONS5 (will work only on Windows 10 1803+) |