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
| immutable(uint[256]) crc32_lookup_table = | |
| { | |
| uint[] table; | |
| foreach (ref i; 0 .. 256) | |
| { | |
| uint crc = i; | |
| foreach (_; 0 .. 8) | |
| crc = crc & 1 ? (crc >> 1) ^ 0xEDB88320 : crc >> 1; | |
| table ~= crc; | |
| } |
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
| import std.intrinsic; | |
| pure uint pop(ref const(uint)[] stream) | |
| { | |
| auto res = bswap(stream[$-1]); | |
| stream.length -= 1; | |
| return res; | |
| } |
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
| DATA |
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
| import std.stdio; | |
| import std.conv; | |
| import std.string : toStringz; | |
| import gl; | |
| import glut; | |
| class ShaderException : Exception |
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
| void screenshot(char filename[160], int x, int y) | |
| { | |
| // get the image data | |
| long imageSize = x * y * 3; | |
| unsigned char *data = new unsigned char[imageSize]; | |
| glReadPixels(0,0, x,y, GL_BGR, GL_UNSIGNED_BYTE, data); | |
| // split x and y sizes into bytes | |
| int xa= x % 256; | |
| int xb= (x - xa) / 256; |
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
| TEMPLATE = app | |
| TARGET = config | |
| QT += core | |
| QT -= gui | |
| CONFIG += console | |
| CONFIG -= app_bundle | |
| LIBS += -lqmfclient |
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
| QMailStore *store = QMailStore::instance(); | |
| QMailAccountIdList accounts = store->queryAccounts(); | |
| QMailAccount account = QMailAccount(accounts[0]); | |
| QMailFolderId folder_id = account.standardFolder(QMailFolder::InboxFolder); | |
| QMailMessageKey folder_key = QMailMessageKey::parentFolderId(folder_id); | |
| QMailThreadKey select_key = QMailThreadKey::includes(folder_key); | |
| // we can only sort by id or serverUid ? | |
| QMailThreadSortKey sort_key = QMailThreadSortKey::id(Qt::AscendingOrder); |
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 isFirstCodepoint(b): | |
| return 0b10000000 & b == 0 or 0b11000000 & b != 0b10000000 | |
| def splitUtf8(arr, i): | |
| if isFirstCodepoint(arr[i]): | |
| return arr[:i], arr[i:] | |
| while i > 0: | |
| i -= 1 | |
| if isFirstCodepoint(arr[i]): | |
| break; |
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
| struct Point { float x, y; } | |
| Point[] triangulate(const ref Point[] contour) | |
| { | |
| assert (contour.length > 2); | |
| Point[] result; | |
| scope size_t[] V; // TODO: V.reserve(contour.length) |
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
| varying vec2 screenPos; | |
| varying float radius; | |
| uniform sampler2D tex; | |
| void main() | |
| { | |
| float dist_squared = distance(gl_FragCoord.xy, screenPos); | |
| // Sphere shaded | |
| if (dist_squared > radius) |