Skip to content

Instantly share code, notes, and snippets.

View kosh04's full-sized avatar
🎧

KOBAYASHI Shigeru kosh04

🎧
View GitHub Profile
@kosh04
kosh04 / flippy.lsp
Created February 3, 2013 19:40
英数字を180度回転した文字を表示するプログラムの #newlisp 版
#!/usr/bin/env newlisp
;; See also: http://id.fnshr.info/2013/01/25/upsidedowntext/
(unless utf8
(throw-error "newlisp cannot use UTF-8 encoding"))
(new Tree 'FlipTable)
(FlipTable
@kosh04
kosh04 / flippy.l
Last active December 12, 2015 02:58
英数字を180度回転して表示するプログラム #xyzzy
;;; -*- Mode: Lisp; Encoding: Shift_JIS -*-
;;; 英数字を180度回転した文字を表示するプログラム
;;; 元ネタ: http://id.fnshr.info/2013/01/25/upsidedowntext/
(provide "flippy")
(in-package "user")
(defvar *flippy-alist* nil)
@kosh04
kosh04 / union_cast.c
Last active December 10, 2015 23:19
共用体(union)は型変換(cast)の代用になるわけではないという話。 コメントはGDBから参照した変数の中身。
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#define init(x) memset((x).byte, '\0', sizeof((x).byte))
int main()
{
union{
char c;
@kosh04
kosh04 / xyzzy.bat
Last active December 10, 2015 17:38
xyzzy 起動用バッチファイル XYZZYHOME フォルダ直下に置いて実行する 参考リンク: USB メモリから xyzzy を使うことはできますか? http://xyzzy.s53.xrea.com/qanda/wiki.cgi?p=78dbc46f4a9c775126b61823e56d7998
@echo off
setlocal
if not defined XYZZYHOME set XYZZYHOME=%CD%
set XYZZYCONFIGPATH=
path %XYZZYHOME%\bin;%PATH%
start %XYZZYHOME%\xyzzycli.exe %*
@kosh04
kosh04 / ExcelApp.js
Created October 30, 2012 06:01
xyzzy/lisp/wip/oletest.lをJScriptで書き直すとこうなる
var app, chart;
app = new ActiveXObject("Excel.Application");
app.Visible = true;
app.Workbooks.Add();
app.Range("a1").Value = 3;
app.Range("a2").Value = 2;
app.Range("a3").Value = 1;
app.Range("a1:a3").Select();
chart = app.Charts.Add();
chart.Type = -4100; // xl3DColumn
@kosh04
kosh04 / QuerySemaphore.c
Last active October 12, 2015 01:37
セマフォの内部カウンタを取得するサンプル #win32
/*
* - Query the Value of a Semaphore
* http://www.codeguru.com/Cpp/W-P/win32/article.php/c1423/
* - Code Snippet - Query Semaphore
* http://www.ragestorm.net/snippet?id=97
* - Semaphores value - statckoverflow
* http://stackoverflow.com/questions/2579536/semaphores-values
* - NtQuerySemaphore - Undocumented function of NTDLL
* http://undocumented.ntinternals.net/UserMode/Undocumented%20Functions/NT%20Objects/Semaphore/NtQuerySemaphore.html
*/
@kosh04
kosh04 / Animals.lsp
Created October 4, 2012 09:52
FOOPでメンバ変数に名前を付ける #newlisp
;; FOOP in newLISP
;; * How find parent context?
(new Class 'Animal)
(new Animal 'Snake) (define Snake:super Animal)
(new Animal 'Horse) (define Horse:super Animal)
(context Animal)
;; constructor
@kosh04
kosh04 / Makefile
Last active September 7, 2018 18:55
WinSock2+FILE I/Oを利用したネットワークサーバのサンプル
CC := gcc
CFLAGS := -std=c99 -Wall -Werror -g3 -O0
LDLIBS := $(if $(findstring MINGW,$(MSYSTEM)),-lws2_32)
TARGET := http-server echo-server
default: $(TARGET)
http-server: http-server.o server.o
echo-server: echo-server.o server.o
@kosh04
kosh04 / gist:2412049
Created April 18, 2012 08:26
#xyzzyで這いよれ!ニャル子さんのアレ
(let ((i 0))
(unless (get 'mode-line-format 'save)
(setf (get 'mode-line-format 'save) mode-line-format))
(defun u-nya- ()
(let ((pattern '("(」・ω・)」うー!"
"(/・ω・)/にゃー!"
"(」・ω・)」うー!"
"(/・ω・)/にゃー!"
"(」・ω・)」うー!"
"(/・ω・)/にゃー!"
@kosh04
kosh04 / mlang.lsp
Created April 18, 2012 03:40
[newLISP]コードページ変換ライブラリ
;; -*- Mode: newlisp; Coding: utf-8; -*-
;; @module mlang.lsp
;; @description CodePage Conversion Library (Windows only)
;; @version 0.1 (2012-04-18) - first commit.
;; @author KOBAYASHI Shigeru (kosh)
;; @license MIT License
;; @links
;; - Introduction to MLang - MSDN