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 code was written by Sergejs Kovrovs and has been placed in the public domain. */ | |
import QtQuick 2.0 | |
MouseArea { | |
property point origin | |
property bool ready: false | |
signal move(int x, int y) | |
signal swipe(string direction) |
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 QtQuick 1.0 | |
import Self 1.0 | |
Rectangle { | |
id: page | |
width: 400; height: 240; | |
anchors.fill: parent | |
DirModel { | |
id: dirModel |
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 getpass, imaplib | |
from itertools import islice | |
from email.parser import HeaderParser | |
def number_set(seq): | |
res = [] | |
last = first = next(seq) | |
for i in seq: | |
assert last < i | |
if i - last == 1: |
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
// g++ gl3.cpp -o gl3 -lX11 -lGL | |
#include <GL/glx.h> | |
#include <GL/gl.h> | |
#include <iostream> | |
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 | |
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 | |
typedef GLXContext (glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*); |
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
/* gcc -framework OpenGL main.c */ | |
#include <OpenGL/OpenGL.h> | |
#include <OpenGL/gl3.h> | |
#include <stdio.h> | |
int main(int argc, char **argv) | |
{ | |
CGLContextObj ctx; | |
CGLPixelFormatObj pix; |
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) |
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
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
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
TEMPLATE = app | |
TARGET = config | |
QT += core | |
QT -= gui | |
CONFIG += console | |
CONFIG -= app_bundle | |
LIBS += -lqmfclient |