Skip to content

Instantly share code, notes, and snippets.

Avatar

MACHIDA Hideki matchy2

View GitHub Profile
@matchy2
matchy2 / rec_nhk.sh
Last active Nov 2, 2020
簡易らじるらじる(NHK)録音スクリプト (2017/09 以降版)
View rec_nhk.sh
#!/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
@matchy2
matchy2 / jqmSimpleMessage.js
Created Dec 27, 2016
jQuery Mobile 1.4系で簡易なポップアップメッセージ
View jqmSimpleMessage.js
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');
@matchy2
matchy2 / docker-cleanup-volumes.sh
Created May 20, 2016
docker で使っていないデータボリュームを一括削除する
View docker-cleanup-volumes.sh
#!/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)"
@matchy2
matchy2 / rec_nhk.sh
Created Sep 20, 2015
簡易らじるらじる(NHK)録音スクリプト (2015/09 以降版)
View rec_nhk.sh
#!/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="."
@matchy2
matchy2 / int2textcast.sql
Created Jun 24, 2015
古いPostgreSQLから移設したデータベースでキャストエラーが出るとき
View int2textcast.sql
-- 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;
View 1password-helper.desktop
[Desktop Entry]
Name=1Password Browser Helper
Comment=Allow browser plugins to interact with the 1Password database
Exec=env WINEPREFIX="/home/<username>/.wine" wine "/home/<username>/.wine/drive_c/Program Files (x86)/1Password 4/Agile1pAgent.exe"
Type=Application
StartupNotify=true
Path=/home/<username>/.wine/drive_c/Program Files (x86)/1Password 4
Icon=C775_1Password.0
StartupWMClass=Agile1pAgent.exe
@matchy2
matchy2 / radiko2gmusic.py
Last active Oct 12, 2016
rec_radiko.sh / rec_nhk.sh で録音したmp3ファイルをパラメータに渡すと GoogleMusic にアップロードしてファイル名から日付をカットしたプレイリストに整理するスクリプト。要 https://github.com/simon-weber/Unofficial-Google-Music-API 。Google ID とパスワードは自分のものに書き換えること
View radiko2gmusic.py
#!/usr/bin/env python
from gmusicapi import Musicmanager
from gmusicapi import Mobileclient
import sys
import os.path
params = sys.argv
@matchy2
matchy2 / putgmusic.py
Last active Oct 17, 2018
GoogleMusic に音声ファイルをアップロードするスクリプト。要 https://github.com/simon-weber/Unofficial-Google-Music-API 。第1引数にファイル名、第2引数にプレイリスト名(省略可)。Google ID とパスワードは自分のものに書き換えること
View putgmusic.py
#!/usr/bin/env python
from gmusicapi import Musicmanager
from gmusicapi import Mobileclient
import sys
import os.path
params = sys.argv
if len(params) < 2:
@matchy2
matchy2 / .ng
Created Jan 19, 2014
Ng (Nihongo micro Gnu emacs) 用設定ファイル例
View .ng
; ~/.ng
;
; for more detail, please read Ng.doc
;
; 'next-line' doesn't insert newline at the end of buffer.
(next-line-add-newlines nil)
; exchange C-h with DEL.
(bsmap-mode)
@matchy2
matchy2 / makepodcast.rb
Last active Mar 15, 2020
指定ディレクトリ内のmp3ファイルから必要最低限のPodcast用RSSを生成する
View makepodcast.rb
#!/usr/bin/env ruby
require 'time'
require 'nkf'
abort "Usage:#{$0} PodcastTitle PublicURL FilesDir" if ARGV.length < 3
title = NKF.nkf('-w', ARGV[0])
location = ARGV[1]
filesDir = ARGV[2]
You can’t perform that action at this time.