Skip to content

Instantly share code, notes, and snippets.

View letoh's full-sized avatar
💭
I may be slow to respond.

letoh letoh

💭
I may be slow to respond.
View GitHub Profile
@letoh
letoh / HIME_CFLAGS.diff
Created December 11, 2011 06:49
accept optional CFLAGS variable
diff --git a/configure b/configure
index d6dc075..4f3e715 100755
--- a/configure
+++ b/configure
@@ -233,7 +233,8 @@ if [ $USE_ANTHY = 'Y' ] || [ $USE_CHEWING = 'Y' ]; then
BUILD_MODULE='Y'
fi
-OPTFLAGS="-O"
+OPTFLAGS=${CFLAGS:--O}
@letoh
letoh / gist:1500190
Created December 20, 2011 04:01
patch for #56
diff --git a/data/Makefile b/data/Makefile
index e6d5c79..adf5f58 100644
--- a/data/Makefile
+++ b/data/Makefile
@@ -1,7 +1,7 @@
include ../config.mak
SRC_DIR = ../src
-IM_CLIENT_DIR = ../src/im-client
@letoh
letoh / frugal-1.0.1_gcc-4.3.3.patch
Created January 17, 2012 03:44
fix compilation failure
diff --git a/extprims.c b/extprims.c
index 2b7c438..1a1c532 100644
--- a/extprims.c
+++ b/extprims.c
@@ -326,7 +326,7 @@ NEWPRIM(acceptconn) {
/* ( listen_sock -- connection_sock ) */
struct sockaddr_in their_addr;
- int tp = sizeof(struct sockaddr_in);
+ socklen_t tp = sizeof(struct sockaddr_in);
@letoh
letoh / gist:1858488
Created February 18, 2012 09:40
xim config in wine
[Software\\Wine\\X11 Driver] 1240428288
"ClientSideAntiAliasWithCore"="N"
"ClientSideAntiAliasWithRender"="N"
"ClientSideWithCore"="Y"
"ClientSideWithRender"="Y"
"DXGrab"="Y"
"UseXIM"="Y"
@letoh
letoh / gist:2010509
Created March 10, 2012 06:00
branch
;;
;; ( f -- ) _if <then_label>
;; do something
;; then_label:
;;
%macro _if 1
cell _0branch
dd %1-%%_offset
%%_offset:
%endmacro
@letoh
letoh / gist:2425569
Created April 20, 2012 03:00
simple tree
#!/bin/sh
find $1 | sed -e 's/^.\///;s/\/$//;s/[^\/]\+\/\([^\/]\+\)$/ + \1/;s/[^\/]\+\// | /g'
void vm_exec_xt(vm_t *vm, xt_t *xt)
{
...
CODE(PLUS):
/* ( n1|u1 n2|u2 -- n3|u3 ) */
ds->cells[ds->pos-2] += ds->cells[--ds->pos];
ENDCODE;
from dsl.scheme import *
(_define . foo
((1, 2, 3)))
(_define . bar
(lambda x: x + 4))
(_display (1, 3))
@letoh
letoh / gist:2702317
Created May 15, 2012 14:45
basic i/o routine
%macro putchar 1
mov ah, 0xe
int 0x10
%endmacro
%macro getchar 1
xor ax, ax
int 0x16
mov ah, 0
%endmacro
@letoh
letoh / gist:2790559
Last active June 7, 2024 09:22
[筆記] 為什麼在 x86,MBR 會被載入到 0x7C00?(完全版)

原文 Assembler / なぜx86ではMBRが"0x7C00"にロードされるのか?(完全版)

感謝 descent 大大分享本文,隨便看隨便譯。本文不是逐句譯,同時也不是這方面的專家 (不管是語言或技術),用語不一或缺漏錯誤在所難免,歡迎自行 fork 修正指教

誰適合看本文?

對 x86 架構與組合語言有基礎認識,以及從 MBR 到載入 OS 這一段過程有興趣的人 (還有談到中斷向量或 INT xxx 時不會一臉茫然的人)