Skip to content

Instantly share code, notes, and snippets.

View ayweak's full-sized avatar

ayweak ayweak

  • Individual
  • Japan
View GitHub Profile
@ayweak
ayweak / UrlEncoder.cs
Created October 18, 2012 15:03
C#を使って文字コード指定してURLエンコードする。
// -*- coding: shift_jis-dos -*-
/*
* D:\somewhere>UrlEncoder.exe encoding string1 [string2...]
*
* e.g.
* D:\somewhere>UrlEncoder.exe euc-jp ^%PATH^%" "abc d\e\^"f^^g
* %25PATH%25+abc
* d%5Ce%22f%5Eg
*/
@ayweak
ayweak / xmlhttprequest_cookie_winxp.js
Created October 18, 2012 16:08
xmlhttprequest_cookie_winxp.js
@ayweak
ayweak / astyle_clipboard.bat
Last active December 20, 2015 19:58
Artistic Style をクリップボードに使いたいようなそんな感じ。 mshta と JScript を利用。
@rem -*- coding: shift_jis-dos -*-
@echo off
set ASTYLE="AStyle.exe" --mode=c -n --style=kr
for /f "usebackq" %%s in (`mshta "javascript:var text = clipboardData.getData('text');var fso;var tmpfilename;var tmpfile;if (text) {fso = new ActiveXObject('Scripting.FileSystemObject');tmpfilename = fso.GetTempName();tmpfile = fso.CreateTextFile(tmpfilename);tmpfile.Write(text);tmpfile.Close();fso.GetStandardStream(1).Write(tmpfilename);}close();"`) do set tmpfilename=%%s
rem var text = clipboardData.getData('text');
rem var fso;
rem var tmpfilename;
@ayweak
ayweak / svn_log_xml2txt.xq
Last active August 29, 2015 13:56
svn log の xml フォーマットをプレーンテキストフォーマット(擬似)に変換する。
xquery version "1.0" encoding "UTF-8";
(: java -cp saxon9he.jar net.sf.saxon.Query -q:svn_log_xml2txt.xq -s:source.xml :)
declare namespace saxon="http://saxon.sf.net/";
declare option saxon:output "method=text";
declare variable $sep-string :=
"------------------------------------------------------------------------";
@ayweak
ayweak / cygwin_my_getclip.sh
Last active August 29, 2015 13:56
Cygwin にクリップボードの内容を渡したり、Cygwin の出力をクリップボードに貼り付けたりする。
#!/usr/bin/sh
cat /dev/clipboard | dos2unix
@ayweak
ayweak / proxied_cmd.sh
Created March 6, 2014 16:02
proxy のある生活。
#!/bin/sh
# -*- coding: utf-8 -*-
# usage1: ~$ ./proxied_cmd.sh yum update
# usage2: ~$ ./proxied_cmd.sh --raw gem install foobar
# (https://www.ruby-forum.com/topic/48641)
# 本当は proxy_user, proxy_password を使うべき。らしい。
HOST=''
@ayweak
ayweak / encode.cs
Created March 6, 2014 16:10
cmd.exe で shift_jis じゃないファイルの内容を表示したいとき。
// -*- coding: utf-8; -*-
// usage1: D:\somewhere>this.exe utf-8 shift_jis file.utf8.txt
// usage2: D:\somewhere>type file.utf8.txt | this.exe utf-8 shift_jis
// note: D:\somewhere>C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe this.cs
using System;
using System.IO;
@ayweak
ayweak / example.wsf
Created March 6, 2014 16:46
JScript で import 的なことをするには .wsf ファイルとする。
<!--
usage:
D:\somewhere>cscript example.wsf
-->
<job id="Example">
<script language="JScript" src="common.js"></script>
<script language="JScript" src="main.js"></script>
</job>
@ayweak
ayweak / random.cmd
Last active August 29, 2015 13:57
%RANDOM% は 0 から 32767 (2^15 - 1) まで。 %ERRORLEVEL% は -2147483648 (2^31) から 2147483647 (2^31 - 1) まで。 (Windows 7 32bit)
@echo off
rem -*- coding: shift_jis-dos -*-
call :MAIN
exit /b
:MAIN
setlocal enabledelayedexpansion
for /l %%i in (-1, 1, 10) do (
call :RANDOM_N %%i
@ayweak
ayweak / 30-redmine.rb.diff
Created November 13, 2014 07:29
Redmineのプラグインのロード順を制御する
--- a/redmine-2.6.0/config/initializers/30-redmine.rb 2014-10-22 04:13:09.000000000 +0900
+++ b/redmine-2.6.0/config/initializers/30-redmine.rb 2014-11-13 16:11:10.000000000 +0900
@@ -16,7 +16,7 @@
openid_authentication_store : :memory
end
-Redmine::Plugin.load
+Redmine::Plugin.load(Redmine::Configuration['plugins'] || ['all'])
unless Redmine::Configuration['mirror_plugins_assets_on_startup'] == false
Redmine::Plugin.mirror_assets