Skip to content

Instantly share code, notes, and snippets.

View matchy256's full-sized avatar

MACHIDA Hideki matchy256

View GitHub Profile
@matchy256
matchy256 / int2textcast.sql
Created June 24, 2015 00:56
古いPostgreSQLから移設したデータベースでキャストエラーが出るとき
-- for PostgreSQL 8.2
CREATE FUNCTION int4text(int4) RETURNS text AS 'SELECT textin(int4out($1))' LANGUAGE sql IMMUTABLE STRICT;
CREATE CAST (int4 AS text) WITH FUNCTION int4text(int4) AS IMPLICIT;
CREATE FUNCTION int8text(int8) RETURNS text AS 'SELECT textin(int8out($1))' LANGUAGE sql IMMUTABLE STRICT;
CREATE CAST (int8 AS text) WITH FUNCTION int8text(int8) AS IMPLICIT;
-- for PostgreSQL 8.4 or later
CREATE CAST (int4 AS text) WITH INOUT AS IMPLICIT;
CREATE CAST (int8 AS text) WITH INOUT AS IMPLICIT;
@matchy256
matchy256 / rec_nhk.sh
Created September 20, 2015 12:47
簡易らじるらじる(NHK)録音スクリプト (2015/09 以降版)
#!/bin/sh
# original code from https://gist.github.com/riocampos/5656450
LANG=ja_JP.utf8
date=`date '+%Y-%m-%d-%H_%M'`
swfVfy="http://www3.nhk.or.jp/netradio/files/swf/rtmpe.swf"
outdir="."
@matchy256
matchy256 / docker-cleanup-volumes.sh
Created May 20, 2016 04:38
docker で使っていないデータボリュームを一括削除する
#!/bin/bash
function do_cleanup {
docker volume rm $(docker volume ls -qf dangling=true)
}
LIST=`docker volume ls -qf dangling=true`
if [ -n "$LIST" ]; then
echo $LIST
echo "Cleanup ? (y/N)"
@matchy256
matchy256 / jqmSimpleMessage.js
Created December 27, 2016 23:38
jQuery Mobile 1.4系で簡易なポップアップメッセージ
function jqmSimpleMessage(message) {
var parent = $('.ui-page-active');
if (parent.length === 0) {
parent = $('body');
}
var div = $('<div data-role="popup" id="__popupmsg" class="ui-content" data-theme="a"></div>');
div.append($('<p></p>').text(message));
var a = $('<a href="#__popupmsg" data-rel="popup" data-position-to="window" id="__popupkicker">popup</a>');
a.css('display', 'none');
@matchy256
matchy256 / rec_nhk.sh
Last active February 11, 2025 06:32
簡易らじるらじる(NHK)録音スクリプト (2022/03 以降版)
#!/bin/bash
pid=$$
date=`date '+%Y-%m-%d-%H_%M'`
outdir="."
if [ $# -le 1 ]; then
echo "usage : $0 channel_name duration(minuites) [outputdir] [prefix]"
exit 1
fi