Skip to content

Instantly share code, notes, and snippets.

@kou1okada
kou1okada / ruby-2.0.0-p247.cygwin64.patch
Created October 29, 2013 05:25
Patch for compiling ruby-2.0.0-p247 on cygwin64
diff -cr ruby-2.0.0-p247.orig/file.c ruby-2.0.0-p247/file.c
*** ruby-2.0.0-p247.orig/file.c 2013-04-25 00:43:05.000000000 +0900
--- ruby-2.0.0-p247/file.c 2013-10-29 14:21:53.112722600 +0900
***************
*** 4181,4187 ****
#ifdef __CYGWIN__
#include <winerror.h>
- extern unsigned long __attribute__((stdcall)) GetLastError(void);
#endif
@kou1okada
kou1okada / hts_engine_API-1.07.cygwin.patch
Created November 13, 2013 01:15
Patch for compiling hts_engine_API-1.07 on cygwin.
*** hts_engine_API-1.07.orig/lib/HTS_misc.c 2012-12-20 17:35:56.000000000 +0900
--- hts_engine_API-1.07/lib/HTS_misc.c 2013-11-12 19:33:33.640684300 +0900
***************
*** 245,255 ****
} else if (fp->type == HTS_FILE) {
fpos_t pos;
fgetpos((FILE *) fp->pointer, &pos);
! #if defined(_WIN32) || defined(__APPLE__)
return (size_t) pos;
#else
@kou1okada
kou1okada / xlscolumn.html
Last active December 29, 2015 15:29
Excel column index and string conversion
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script>
/**
* Excel column index and string conversion
* Copyright 2013 (c) Koichi OKADA. All rights reserved.
* This code is distributed under the MIT license.
@kou1okada
kou1okada / cygwin64_rbenv_install_ruby-2.0.0-p353.sh
Created December 4, 2013 15:48
Install ruby-2.0.0-p353 to rbenv on cygwin64.
#!/usr/bin/env bash
TARGET_URL=http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz
PATCH_URL=https://gist.github.com/kou1okada/7209539/raw/68c845108504285a44a99d01aa0db60f88d81dda/ruby-2.0.0-p247.cygwin64.patch
HASH="$(cat <<EOD
78282433fb697dd3613613ff55d734c1 *ruby-2.0.0-p353.tar.gz
067532b28c5a42b93aa6dc5ba42c630c *ruby-2.0.0-p247.cygwin64.patch
EOD
)"
TARGET_ARCHIVE="${TARGET_URL##*/}"
@kou1okada
kou1okada / Cygwin32MinttyHere.inf
Last active June 12, 2018 00:57
Cygwin mintty here
;------------------------------------------------------------------------------
; $Id: $
;------------------------------------------------------------------------------
; Cygwin32 mintty here
; Copyright (c) 2013 Koichi OKADA
;
; License:
; The MIT Licensee.
;------------------------------------------------------------------------------
[version]
@kou1okada
kou1okada / cygwin_autoinstall.bat
Last active March 17, 2025 11:21
Cygwin automatic installer
@ECHO OFF
REM Cygwin automatic installer
REM Copyright (c) 2013-2015 Koichi OKADA. All rights reserved.
REM This script is distributed under the MIT license.
REM http://www.opensource.org/licenses/mit-license.php
SETLOCAL
CD %~dp0
@kou1okada
kou1okada / recdur.sh
Last active January 11, 2022 11:53
recdur.sh - record duration calculator
#!/usr/bin/env bash
function recdur ()
{
local TIMESTAMP=$(stat -c %y "$1" | sed -e 's/[-:.]/ /g' | cut -d" " -f1-6)
local DURATION=$(ffmpeg -i "$1" 2>&1 | grep Duration | sed -e 's/[:.,]/ /g' | cut -d" " -f4-7)
awk 'BEGIN{
stamp=mktime(ARGV[1]" "ARGV[2]" "ARGV[3]" "ARGV[4]" "ARGV[5]" "ARGV[6]);
t1=mktime("2000 01 01 00 00 00");
t2=mktime("2000 01 01 "ARGV[7]" "ARGV[8]" "ARGV[9]);
print(strftime("%Y%m%d_%H%M%S",stamp-(t2-t1))"-"strftime("%Y%m%d_%H%M%S",stamp));
@kou1okada
kou1okada / Makefile.am
Created January 14, 2014 14:47
A skeleton of the C++ project files which uses Magick++, Boost and Autotools.
AM_CXXFLAGS = -mcmodel=large
AM_CXXFLAGS += $(MAGICKXX_CFLAGS)
LDADD = $(MAGICKXX_LIBS) -lboost_filesystem-mt -lboost_program_options-mt -lboost_system-mt
bin_PROGRAMS = omr
omr_SOURCES = omr.cpp
@kou1okada
kou1okada / Makefile.nkf_for_cygwin.in
Created January 15, 2014 09:24
build package of nkf for cygwin
SRCDIR=@SRCDIR@
WORKDIR=@WORKDIR@
VERSION=@VERSION@
PRJNAME=@PRJNAME@
PKGFILE=$(PRJNAME)/$(PRJNAME)-$(VERSION).tar.bz2
.PHONY : all build clean
all: $(PKGFILE)
@echo =========================================
@kou1okada
kou1okada / pkg2repos.sh
Created January 15, 2014 09:32
copy packages to local repository of cygwin.
#!/usr/bin/env bash
HAVE_APT_CYG="$(which apt-cyg 2>/dev/null)" || { echo -e "\e[31;1mError:\e[30;0m atp-cyg is not found."; exit 1; }
HAVE_UPSET_SH="$(which upset.sh 2>/dev/null)"
while [ $# -gt 0 ]; do
case "$1" in
-a)
shift
OPT_A="$1"
shift