Skip to content

Instantly share code, notes, and snippets.

@miau
miau / try.tbl
Last active June 8, 2017 16:24
Try-Code 用テーブルファイル。UTF-8になっているので、漢直Winで使う場合にはShift_JISで保存しなおしてください。
;; -------------------------------------------------------------------
;; try.tbl 2017-05-25
;; -------------------------------------------------------------------
;;
;; 高橋直人さんによる 3 ストローク拡張
;;
;; <http://web.archive.org/web/20090511144824/http://www.m17n.org/ntakahas/npx/aggressive/aggressive0.ja.html>
;;
;; <http://web.archive.org/web/20090326082244/http://www.m17n.org/ntakahas/npx/aggressive/tcode-qwerty.html>
;; <http://web.archive.org/web/20090108102027/http://www.m17n.org/ntakahas/npx/aggressive/tcode-ex-qwerty.html>
@miau
miau / gist:efa42e4aa5a57ccf5354ef4993c4b7a3
Last active April 6, 2017 04:08 — forked from onozaty/gist:b36bdf49872e76c3139b
Slide and scroll sidebar by Redmine view customize plugin
// Gitmike テーマ用のカスタマイズ版。
// public/themes/gitmike/stylesheets/application.css 中の定義も以下のように変更する必要あり。
// #sidebar { width: 260px !important; ... }
// ↓
// #sidebar { width: 260px; ... }
$(function() {
$('#content')
.css({
'width': 'auto',
ruby -e "open(`gem which rubygems`.sub(/\.rb\s*\z/, '/ssl_certs/GlobalSignRootCA.pem'), 'wb').write %(-----BEGIN CERTIFICATE-----\nMIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG\nA1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv\nb3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw\nMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i\nYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT\naWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ\njc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp\nxy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp\n1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG\nsnUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ\nU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8\n9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E\nBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B\nAQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK
@miau
miau / update_changeset_comment.patch
Created August 29, 2016 08:53
Patch to add a action to resync revprop-change of subversion
diff -ur redmine_org/app/controllers/sys_controller.rb redmine/app/controllers/sys_controller.rb
--- redmine_org/app/controllers/sys_controller.rb 2014-10-22 00:42:48.000000000 +0530
+++ redmine/app/controllers/sys_controller.rb 2016-08-29 14:08:22.718880800 +0530
@@ -68,6 +68,29 @@
render :nothing => true, :status => 404
end
+ def update_changeset_comment
+ scope = Project.active.has_module(:repository)
+ project = nil
@miau
miau / replace_svn_log.rb
Created January 8, 2016 09:08
A script to replace svn:log property of revisions
require "tempfile"
require "rexml/document"
REVISION_FROM = "86678"
REVISION_TO = "HEAD"
REGEX = /#19358/
REPLACE = "#18958"
xml = `svn log -r#{REVISION_FROM}:#{REVISION_TO} --xml`
doc = REXML::Document.new xml
@miau
miau / local.conf
Last active November 16, 2015 14:27
Blacklist Sazanami fonts
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<selectfont>
<rejectfont>
<pattern>
<patelt name="family"><string>Sazanami Gothic</string></patelt>
</pattern>
</rejectfont>
<rejectfont>
@miau
miau / gist:a27beec55296244d4ab1
Last active November 18, 2015 05:03
Excel VBA that removes white background color
Sub RemoveWhiteBgcolor()
With Application.FindFormat.Interior
.PatternColorIndex = xlAutomatic
.Color = &HFFFFFF
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Application.ReplaceFormat.Interior
.Pattern = xlNone
.TintAndShade = 0
ruby -e "open(`gem which rubygems`.sub(/\.rb\s*\z/, '/ssl_certs/AddTrustExternalCARoot-2048.pem'), 'wb').write %(-----BEGIN CERTIFICATE-----\nMIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU\nMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs\nIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290\nMB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux\nFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h\nbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v\ndDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt\nH7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9\nuMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX\nmk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX\na0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN\nE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0\nWicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD\nVR0PBAQDAgEGMA8GA1UdEwEB
@miau
miau / doctrine_oci8_optimize.patch
Created May 18, 2014 08:24
Doctrine DBAL のパラメータ置換処理(「?」を「:param1」等に書き換える処理)を高速化するパッチ。
Index: Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
===================================================================
--- Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
+++ Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
@@ -72,26 +72,23 @@
* @return string
*/
static public function convertPositionalToNamedPlaceholders($statement)
- {
- $count = 1;
@miau
miau / poh2.php
Last active August 29, 2015 14:01
A solution for paiza online hackathon Vol.2 https://paiza.jp/poh/paizen
<?php
fscanf(STDIN, '%d%d', $h, $w);
$rawMap = stream_get_contents(STDIN, $h * ($w + 1));
$chars = "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#\$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82";
$rawMap = strtr($rawMap, '1', "\0");
$rawMap = strtr($rawMap, "\n", "\xff");
$rawMap = preg_replace_callback(
'/0+/',
function($m) use ($chars, $w) {