Skip to content

Instantly share code, notes, and snippets.

View kosh04's full-sized avatar
🎧

KOBAYASHI Shigeru kosh04

🎧
View GitHub Profile
@kosh04
kosh04 / dirent.c
Last active August 29, 2015 14:05
dirent.h と _USE_32BIT_TIME_T の組み合わせがバグっているかもしれない話 #mingw32
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
int main(int argc, char *argv[])
{
struct dirent *entry;
DIR *dir;
char *path;
#include <stdio.h>
#include <stdint.h>
#include <time.h>
#include <unistd.h>
#include <sys/time.h>
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define sleep(sec) Sleep(sec * 1000)
@kosh04
kosh04 / wandbox-autoprofiles.el
Last active August 29, 2015 14:05
emacs-wandbox Git:feature/autoprofile にて生成されたプロファイルの例 [2014/08/26 現在]
(require 'wandbox)
;; wandbox-profiles
((:lang "C++" :name "gcc HEAD" :compiler "gcc-head" :options "warning,boost-1.56,sprout,gnu++1y" :ext "cc")
(:lang "C++" :name "gcc" :compiler "gcc-4.9.0" :options "warning,boost-1.56,sprout,gnu++1y" :ext "cc")
(:lang "C++" :name "gcc" :compiler "gcc-4.8.2" :options "warning,boost-1.56,sprout,gnu++1y" :ext "cc")
(:lang "C++" :name "gcc" :compiler "gcc-4.8.1" :options "warning,boost-1.56,sprout,gnu++1y" :ext "cc")
(:lang "C++" :name "gcc" :compiler "gcc-4.7.3" :options "warning,boost-1.56,sprout,gnu++11" :ext "cc")
(:lang "C++" :name "gcc" :compiler "gcc-4.6.4" :options "warning,boost-1.56,sprout,gnu++0x" :ext "cc")
(:lang "C++" :name "gcc" :compiler "gcc-4.5.4" :options "warning,boost-1.56,gnu++0x" :ext "cc")
@kosh04
kosh04 / howto.md
Last active August 29, 2015 14:04
MinGW で Readline 6.3 をコンパイルする
@kosh04
kosh04 / test-matherr.c
Created July 17, 2014 16:13
Test matherr
// see also:
// http://msdn.microsoft.com/ja-jp/library/k3backsw.aspx
// http://linuxjm.sourceforge.jp/html/LDP_man-pages/man3/matherr.3.html
#define _SVID_SOURCE
#include <math.h>
#include <string.h>
#include <stdio.h>
#ifdef _WIN32
@kosh04
kosh04 / wandbox.el
Last active December 29, 2015 02:18
Wandbox を Emacs から利用する. Warning : This repo was moved to https://github.com/kosh04/emacs-wandbox
;;; wandbox.el --- Wandbox interface for Emacs
;; Let's Play Wandbox!
;; - http://melpon.org/wandbox/
;; - https://github.com/melpon/wandbox >>> /kennel/API.rst
;;; Example:
;; ## インタラクティブに利用する
;;
@kosh04
kosh04 / nl-json.c
Last active December 19, 2015 00:00
JSONパーサ <https://github.com/kgabis/parson> を #newlisp に組み込むとこんな感じになる。 エラー無視。パースのみ。シリアライズなし。追加引数を与えるとドット記法での探索が可能。 処理速度は json-parse の方が早い。
/* nl-json.c */
#include "newlisp.h"
#include "protos.h"
#include "nl-json.h"
CELL * stuffList(int length, ...)
{
CELL * list;
int i;
@kosh04
kosh04 / fibonacci.lsp
Last active December 17, 2015 18:49
ラムダ式の内部にデータを格納したフィボナッチ計算 関数に名前がないと値の参照ができないので実用的ではない
#!/usr/bin/env newlisp
;; 可能ならbigintを使用する
(when (primitive? bigint)
(constant '_+ +
'+ (lambda () (apply _+ (map bigint (args))))))
; (define (fibonacci n)
; (if (< n 2)
; 1
@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