Skip to content

Instantly share code, notes, and snippets.

View kosh04's full-sized avatar
🎧

KOBAYASHI Shigeru kosh04

🎧
View GitHub Profile
@kosh04
kosh04 / win32-ping.lsp
Created March 15, 2013 11:00
icmp.dllを利用したwin32版ping
#!newlisp
;; PING for newLISP (win32)
;;
;; Usage:
;; > newlisp ping.lsp localhost
;; > newlisp ping.lsp -w 2000 gist.github.com
;;
;; License:
;; MIT License
@kosh04
kosh04 / flashcopy.bat
Created March 2, 2013 15:12
Chromeで再生している動画のキャッシュデータを保存する
@echo off
rem for Google Chrome v21 or later
rem set TARGET=*.tmp
rem set SRC=%LOCALAPPDATA%\Google\Chrome\User Data\Default\Pepper Data\Shockwave Flash
rem for Chrome v20 or older (and v25)
set TARGET=fla*.tmp
set SRC=%LOCALAPPDATA%\Temp
@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 %*
;;; dotassoc.lsp
;; 連想リストの Key-Value 参照をドット記法で
;;; Example:
;; (let ((student '((id 1332412)
;; (name ((first "Student")
;; (last "Example"))))))
;; (with-dotassoc
@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