Skip to content

Instantly share code, notes, and snippets.

View qtxie's full-sized avatar
🏠
Working from home

Qingtian qtxie

🏠
Working from home
  • FullStack Technologies
View GitHub Profile
@qtxie
qtxie / ANSI.md
Created October 5, 2023 02:11 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
qt@DESKTOP-M49UILA:~$ ./console castr-open-url/open-url.red
epoll_ctl fd: 5 op: 1 evts: 80000001
tls
tls://140.82.121.4:443
tls/open
tls client
socket/bind
epoll_ctl fd: 6 op: 1 evts: 80000004
cnt: 1
iocp: 32
Red [
Title: "Simple HTTP server"
Notes: {
The compiler is not able to compile it.
}
]
httpd: context [
debug: :print
REBOL []
Red []
do {
src: [
#switch OS [
Windows [#define LIBREDRT-file "libRedRT.dll"]
macOS [#define LIBREDRT-file "libRedRT.dylib"]
#default [#define LIBREDRT-file "libRedRT.so"]
]
Red [Needs: View]
start?: no
total1: 0 total2: 0 total3: 0
n1: n2: n3: 0
NUM: 10
view [
b1: base 500x500 on-drawing [
unless start? [exit]
cmds: reduce ['pen red]
@qtxie
qtxie / windows_nanosleep.c
Created March 27, 2020 07:53 — forked from Youka/windows_nanosleep.c
Windows nanosleep
#include <windows.h> /* WinAPI */
/* Windows sleep in 100ns units */
BOOLEAN nanosleep(LONGLONG ns){
/* Declarations */
HANDLE timer; /* Timer handle */
LARGE_INTEGER li; /* Time defintion */
/* Create timer */
if(!(timer = CreateWaitableTimer(NULL, TRUE, NULL)))
return FALSE;
Red/System []
int64!: alias struct! [
low [integer!]
high [integer!]
]
sub64: func [ ;-- result: a - b
a [int64! value]
b [int64! value]
转换的代码应该是平台无关的。Draw里只需要很少的改动。
runtime/datatypes/image.reds 里增加一个函数:
```
any-resize: func [
;-- 4 points resize (also support 3 points)
src [red-image!]
dst [red-image!]
crop1 [red-pair!]
start [red-pair!] ;-- first point
1. 安装32位库
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install build-essential gcc-multilib rpm libstdc++6:i386 libgtk-3-0:i386 libcurl3:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386
2. 安装git
sudo apt-get install git
3. 下载Rebol for Linux
https://1drv.ms/u/s!Am3tb4OZU9Jqpyxm6GtGsPY3ToI-
// Source Code: https://gist.github.com/qtxie/12c087db8a2c0c2d9fe0104af2f4236e
// compare Cell struct
// struct Cell {
// int header;
// int pading;
// int value;
// int pading2;
// Cell(int x) : value(x) {}
// bool operator<(const Cell& r) const
// {