In an IMGUI we need a way to identify which control is active
or hot
. For example,
when we press a key, which text box does the text go to.
Possible options:
- Sequential number (Unity)
Each control drawn gets a sequentially increasing number.
#ifndef _CRT_SECURE_NO_WARNINGS | |
# define _CRT_SECURE_NO_WARNINGS | |
#endif | |
#ifndef _CRT_NONSTDC_NO_DEPRECATE | |
# define _CRT_NONSTDC_NO_DEPRECATE | |
#endif | |
#include <vector> | |
// ------------------------------------------------------------------------------------------------- |
int main() { | |
char *path = "/path/to/my/directory"; | |
print("watching %s for changes...\n", path); | |
HANDLE file = CreateFile(path, | |
FILE_LIST_DIRECTORY, | |
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, | |
NULL, | |
OPEN_EXISTING, | |
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, |
-module(systemd). | |
% This is what you need to adopt systemd in erlang | |
% | |
% Do whatever you want license. If you want, you can take this code under terms of MIT license. | |
-export([ready/0, reloading/0, stopping/0, watchdog/0]). | |
-export([start_link/0]). | |
-export([init/1, handle_info/2, terminate/2]). |
// Taken from the Rust code base: https://github.com/rust-lang/rust/blob/3809bbf47c8557bd149b3e52ceb47434ca8378d5/src/libstd/sys_common/mod.rs#L124 | |
// Computes (value*numer)/denom without overflow, as long as both | |
// (numer*denom) and the overall result fit into i64 (which is the case | |
// for our time conversions). | |
int64_t int64MulDiv(int64_t value, int64_t numer, int64_t denom) { | |
int64_t q = value / denom; | |
int64_t r = value % denom; | |
// Decompose value as (value/denom*denom + value%denom), | |
// substitute into (value*numer)/denom and simplify. | |
// r < denom, so (denom*numer) is the upper bound of (r*numer) |
Originally from: http://erlang.org/pipermail/erlang-questions/2017-August/093170.html | |
For a safe and fast Erlang SSL server, there's a few | |
configuration values you might want by default: | |
[{ciphers, CipherList}, % see below | |
{honor_cipher_order, true}, % pick the server-defined order of ciphers | |
{secure_renegotiate, true}, % prevent renegotiation hijacks | |
{client_renegotiation, false}, % prevent clients DoSing w/ renegs | |
{versions, ['tlsv1.2', 'tlsv1.1']}, % add tlsv1 if you must |
// | |
// _oo0oo_ | |
// o8888888o | |
// 88" . "88 | |
// (| -_- |) | |
// 0\ = /0 | |
// ___/`---'\___ | |
// .' \\| |// '. | |
// / \\||| : |||// \ | |
// / _||||| -:- |||||- \ |
import M2Crypto | |
def main(): | |
manifest_path = 'path/to/manifest.json' | |
signature_path = 'path/to/signature' | |
# to convert .cer to .pem | |
# openssl x509 -inform der -in certificate.cer -out certificate.pem | |
# to combine certificate and key | |
# cat PushChatCert.pem PushChatKey.pem > ck.pem |
// intel CPUID opcode | |
// see: https://en.wikipedia.org/wiki/CPUID | |
// clang -Wall -Wextra -std=c11 cpuinfo.c -o cpuinfo | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <cpuid.h> //macro __cpuid(eaxin, eaxout, ebx, ecx, edx) | |
int main() { | |
{ |
function construct(constructor, args) { | |
function F() { | |
return constructor.apply(this, args); | |
} | |
F.prototype = constructor.prototype; | |
return new F(); | |
} | |
// Sanboxer | |
function sandboxcode(string, inject) { | |
"use strict"; |