Skip to content

Instantly share code, notes, and snippets.

View kosh04's full-sized avatar
🎧

KOBAYASHI Shigeru kosh04

🎧
View GitHub Profile
@kosh04
kosh04 / go-playground.sh
Created October 1, 2015 09:30
Go Playground をコマンドラインから叩く
#/bin/sh
# Description: Go Playground command line interface
# Link: http://blog.golang.org/playground
# Usage:
# - go-playground.sh FILENAME
# - go-playground.sh < FILENAME
compile_url=https://play.golang.org/compile
version=2
@kosh04
kosh04 / slash-fn.lsp
Created September 29, 2015 06:01
Clojure like fn macro #(...) on newLISP
(define-macro (\)
(expand
(append (fn ()) (list (args)))
'((% (args 0))
(%1 (args 0))
(%2 (args 1))
(%3 (args 2))
(%4 (args 3))
(%5 (args 4)))))
@kosh04
kosh04 / README.md
Created August 29, 2015 18:58
GitHub Markdown APIをコマンドラインで利用
@kosh04
kosh04 / attach-console.c
Last active May 2, 2022 14:49
WinMainなプログラムでもコンソール出力がしたい
// attach-console.c
// Usage1: > cl attach-console.c & attach-console.exe
// Usage2: $ gcc attach-console.c && ./a.exe
#define _WIN32_WINNT 0x0501
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
@kosh04
kosh04 / mingw-w64.patch
Created February 14, 2015 19:27
MinGW-w64 build patch for newlisp v10.6.2
diff --git a/newlisp.c b/newlisp.c
index 211ad93..1b9b851 100644
--- a/newlisp.c
+++ b/newlisp.c
@@ -18,7 +18,6 @@
*/
#include "newlisp.h"
-#include "pcre.h"
#include "protos.h"
@kosh04
kosh04 / os.mk
Last active October 24, 2017 11:56
Makefileで使用するコンパイラからターゲットとなるプラットフォームを判定する
CC ?= cc
usage := make -f $(notdir $(MAKEFILE_LIST)) [CC=cc]
platform_list := linux bsd darwin mingw cygwin solaris
machine := $(shell $(CC) -dumpmachine)
# $(call grep, string, word-list)
grep = $(strip $(foreach word,$2,$(findstring $(word),$1)))
@kosh04
kosh04 / htmlmail.sh
Last active August 29, 2015 14:10
htmlメールを送る
#/bin/sh
MAILTO=xxx@gexmple.com
MAILFROM=yyy@example.com
SUBJECT=Hello
HTML=$(curl -s http://leemunroe.github.io/html-email-template/email.html)
sendmail -i $MAILTO <<EOF
From: $MAILFROM
To: $MAILTO
@kosh04
kosh04 / Makefile.pcre
Last active August 29, 2015 14:08
newLISPの埋め込みPCREを最新バージョンに置き換える
# -*- mode: makefile -*-
#
# force update PCRE embedded in newLISP
# ~> wget http://www.newlisp.org/downloads/development/newlisp-10.6.1.tgz
# ~> tar xvf newlisp-10.6.1.tgz
# ~> cd newlisp-10.6.1
# ~> curl -LOk https://gist.githubusercontent.com/kosh04/36d754f6f9a99fcdf374/raw/Makefile.pcre
# ~> make -f Makefile.pcre enable_utf8=1
# ~> make -f Makefile.pcre test
@kosh04
kosh04 / nicopedia-resanchor-popup.user.js
Last active August 29, 2015 14:07
ニコニコ大百科掲示板のレスアンカーをポップアップ表示するUserScript
// ==UserScript==
// @name Nicopedia Resanchor Popup
// @namespace http://lambda.que.jp/
// @version 0.1.20141108
// @description ニコニコ大百科掲示板のレスアンカーをポップアップ表示する
// @grant GM_addStyle
// @grant GM_getResourceURL
// @grant GM_getResourceText
// @match http://dic.nicovideo.jp/*
// @require http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js
@kosh04
kosh04 / result.md
Last active August 29, 2015 14:05
mktime, localtime 関数は環境変数 TZ を参照する

実行結果

$ gcc prog/c/timezone.c && TZ=UTC ./a.exe
mktime() = 0
gmtime((t=0,&t))         : Thu Jan 01 00:00:00 1970
localtime((t=0,&t))      : Thu Jan 01 00:00:00 1970
gmtime((t=32400,&t))     : Thu Jan 01 09:00:00 1970
localtime((t=32400,&t))  : Thu Jan 01 09:00:00 1970