Skip to content

Instantly share code, notes, and snippets.

@keyou
keyou / stopwatch.cc
Last active July 12, 2020 13:49
A stopwatch accurate to milliseconds.
// Author: keyou
// https://github.com/keyou
// A stopwatch accurate to milliseconds.
// compile command: g++ -std=c++11 -O3 stopwatch.cc -o stopwatch
#include <iostream>
#include <numeric>
#include <chrono>
#include <thread>
@keyou
keyou / testprogram.c
Created July 1, 2020 14:42 — forked from je-so/testprogram.c
Xlib transparent window with OpenGL support
/*
____ _____
/\__ \ /\ ___\
\/__/\ \ \ \ \__/_
\ \ \ \ \____ \
_\_\ \ \/__/_\ \
/\ _____\ /\ _____\
\/______/ \/______/
Copyright (C) 2011 Joerg Seebohn
@keyou
keyou / init_window.c
Created November 1, 2019 09:33 — forked from Miouyouyou/init_window.c
A very ugly Wayland EGL OpenGL example
// gcc -o test init_window.c -I. -lwayland-client -lwayland-server -lwayland-client-protocol -lwayland-egl -lEGL -lGLESv2
#include <wayland-client.h>
#include <wayland-server.h>
#include <wayland-client-protocol.h>
#include <wayland-egl.h> // Wayland EGL MUST be included before EGL headers
#include "init_window.h"
#include "log.h"
#include <string.h>
@keyou
keyou / socket_portable
Created August 26, 2019 06:16 — forked from FedericoPonzi/socket_portable.c
C sockets portable in windows/linux example
// As seen on http://www.di.uniba.it/~reti/LabProRete/Interazione(TCP)Client-Server_Portabile.pdf
#if defined WIN32
#include <winsock.h>
#else
#define closesocket close
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#endif
#include <stdio.h>
@keyou
keyou / gclient.html
Created November 2, 2017 04:25
gclient
<html lang="en"><head>
<meta charset="UTF-8">
<title></title>
<style id="system" type="text/css">*{margin:0;padding:0;}body { font:13.34px helvetica,arial,freesans,clean,sans-serif; color:black; line-height:1.4em; background-color: #F8F8F8; padding: 0.7em;}p { margin:1em 0; line-height:1.5em;}table { font-size:inherit; font:100%; margin:1em;}table th{border-bottom:1px solid #bbb;padding:.2em 1em;}table td{border-bottom:1px solid #ddd;padding:.2em 1em;}input[type=text],input[type=password],input[type=image],textarea{font:99% helvetica,arial,freesans,sans-serif;}select,option{padding:0 .25em;}optgroup{margin-top:.5em;}pre,code{font:12px Monaco,"Courier New","DejaVu Sans Mono","Bitstream Vera Sans Mono",monospace;}pre { margin:1em 0; font-size:12px; background-color:#eee; border:1px solid #ddd; padding:5px; line-height:1.5em; color:#444; overflow:auto; -webkit-box-shadow:rgba(0,0,0,0.07) 0 1px 2px inset; -webkit-border-radius:3px; -moz-border-radius:3px;border-radius:3px;white-space: pre-wrap;word-wrap:b
@keyou
keyou / cloudSettings
Created October 10, 2017 05:08
Visual Studio Code Settings Sync Gist
// Empty
@keyou
keyou / cloudSettings
Created October 10, 2017 05:08
Visual Studio Code Settings Sync Gist
// Empty
@keyou
keyou / cloudSettings
Last active June 15, 2017 01:35
Visual Studio Code Sync Settings Gist
{"lastUpload":"2017-06-15T01:17:37.811Z","extensionVersion":"v2.8.1"}