Last active
July 1, 2020 05:46
-
-
Save ten9miq/706daa8a337a3f1567e5b9cefcf8eec0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var listeners = getEventListeners(document); | |
Object.keys(listeners).forEach(event => { | |
if (["pointerover", "pointerout", "pointerleave", "pointerenter", "mouseleave", "pointermove", "mouseover", "mouseout", "mousemove", "mousedown", "mouseup","scroll","mousewheel"].includes(event) == false) { | |
document.addEventListener(event, e => console.log("俺:" + e.type, e)); | |
console.log("ok", event, listeners[event]); | |
} else { | |
console.log("noooo", event, listeners[event]); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//キーボードマクロのファイル | |
S_ReplaceAll('\\/\\*.+?\\*\\/', '', 1084); // | |
S_ReplaceAll('^.+?console.log.+?\\)\\;', '', 1084); // | |
S_ReplaceAll('^[ \\t]*\\r\\n', '', 1084); // | |
S_ReDraw(0); // 再描画 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ALL USER CRON-BUCKUP | |
* * * * * for user in $(ls /var/spool/cron); do mkdir -p ~/.crontab-editlog/$user/; crontab -u $user -l >~/.crontab-editlog/$user/$(date +\%Y\%m\%d_\%H\%M).log && [ $(ls -t ~/.crontab-editlog/$user/*.log 2>/dev/null |wc -l) -gt 1 ] && diff $(ls -t ~/.crontab-editlog/$user/*.log | head -1) $(ls -t ~/.crontab-editlog/$user/*.log |head -2 |tail -1) >>/var/tmp/cron-diff_${user}_$(date +\%Y\%m).log 2>&1 && ( echo -n "non change log file " >>/var/tmp/cron-diff_${user}_$(date +\%Y\%m).log; rm -v $(ls -t ~/.crontab-editlog/$user/*.log | head -1) >>/var/tmp/cron-diff_${user}_$(date +\%Y\%m).log 2>&1 ) ; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//キーボードマクロのファイル | |
S_InsText('■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■'); // テキストを貼り付け | |
S_Char(13);// 改行挿入 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* @file line-up.js | |
* @brief 選択範囲のある複数行、もしくはカーソル行を上の行と入れ替える | |
* @author nori_51 | |
* | |
* ・eclipseの[Alt+↑]と同等の動きになるよう作成。 | |
* | |
*/ | |
// ------------------------------------------------------------------------------------ | |
// ファイル編集モード取得 | |
// ------------------------------------------------------------------------------------ | |
function getOpenMode(){ | |
return Editor.ExpandParameter("${R?r$:$:$}"); | |
} | |
// ------------------------------------------------------------------------------------ | |
// カーソル位置情報取得 | |
// 現在のカーソル位置を、開始行/開始桁/終了行/終了桁の順の配列で返す。 | |
// 非選択状態の場合は、開始行 = 終了行、開始桁 = 終了桁 となる。 | |
// ------------------------------------------------------------------------------------ | |
function getCursorPosition(){ | |
if(Editor.IsTextSelected() != 0){ | |
return [Editor.GetSelectLineFrom(), Editor.GetSelectColmFrom(), | |
Editor.GetSelectLineTo(), Editor.GetSelectColmTo()]; | |
}else{ | |
Editor.BeginSelect(0); | |
var ret = [Editor.GetSelectLineFrom(), Editor.GetSelectColmFrom(), | |
Editor.GetSelectLineTo(), Editor.GetSelectColmTo()]; | |
Editor.CancelMode(0); | |
return ret; | |
} | |
} | |
// ------------------------------------------------------------------------------------ | |
// 行入れ替え(上) | |
// ------------------------------------------------------------------------------------ | |
function moveUp(cursorPosition){ | |
// 入れ替えを受ける行の内容を取得 | |
Editor.MoveCursorLayout(cursorPosition[0]-1,1,0); | |
var str1 = Editor.GetLineStr(0); | |
// 入れ替えを試みる側の内容を取得。選択中の場合は選択範囲が含まれる全行が対象 | |
Editor.MoveCursorLayout(cursorPosition[0],1,0); | |
Editor.BeginSelect(); | |
for (var i=-1 ; i<cursorPosition[2]-cursorPosition[0] ; i++){ | |
Editor.Down(); | |
} | |
var str2 = Editor.GetSelectedString(0); | |
// カーソルを入れ替え先に移動 | |
Editor.MoveCursorLayout(cursorPosition[0]-1,1,0); | |
// 入れ替え先、入れ替え内容ともに選択 | |
Editor.MoveCursorLayout(cursorPosition[2]+1,1,1); | |
// 入れ替えた文字列を挿入 | |
Editor.InsText(str2+str1); | |
} | |
// ------------------------------------------------------------------------------------ | |
// カーソル/選択状態の復旧 | |
// ------------------------------------------------------------------------------------ | |
function repair(cursorPosition){ | |
Editor.MoveCursorLayout(cursorPosition[0],cursorPosition[1],0); | |
if((cursorPosition[0]!=cursorPosition[2])||(cursorPosition[1]!=cursorPosition[3])){ | |
Editor.MoveCursorLayout(cursorPosition[2],cursorPosition[3],1); | |
} | |
} | |
// ------------------------------------------------------------------------------------ | |
// main | |
// ------------------------------------------------------------------------------------ | |
(function(){ | |
// 読み取り専用の場合は動作しない | |
if (getOpenMode() == "r") return; | |
// カーソル位置情報 | |
var cursorPosition = getCursorPosition(); | |
//Editor.SetDrawSwitch(0); | |
// 選択範囲が最初の行を含んでいる場合、動作しない | |
if (cursorPosition[0] <= 1) return; | |
moveUp(cursorPosition); | |
// cursorPositionの行番号を置換後の値に更新 | |
cursorPosition[0] = cursorPosition[0]-1; | |
cursorPosition[2] = cursorPosition[2]-1; | |
repair(cursorPosition); | |
//Editor.SetDrawSwitch(1); | |
Editor.ReDraw(); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* @file line-down.js | |
* @brief 選択範囲のある複数行、もしくはカーソル行を下の行と入れ替える | |
* @author nori_51 | |
* | |
* ・eclipseの[Alt+↓]と同等の動きになるよう作成。 | |
* | |
*/ | |
// ------------------------------------------------------------------------------------ | |
// ファイル編集モード取得 | |
// ------------------------------------------------------------------------------------ | |
function getOpenMode(){ | |
return Editor.ExpandParameter("${R?r$:$:$}"); | |
} | |
// ------------------------------------------------------------------------------------ | |
// カーソル位置情報取得 | |
// 現在のカーソル位置を、開始行/開始桁/終了行/終了桁の順の配列で返す。 | |
// 非選択状態の場合は、開始行 = 終了行、開始桁 = 終了桁 となる。 | |
// ------------------------------------------------------------------------------------ | |
function getCursorPosition(){ | |
if(Editor.IsTextSelected() != 0){ | |
return [Editor.GetSelectLineFrom(), Editor.GetSelectColmFrom(), | |
Editor.GetSelectLineTo(), Editor.GetSelectColmTo()]; | |
}else{ | |
Editor.BeginSelect(0); | |
var ret = [Editor.GetSelectLineFrom(), Editor.GetSelectColmFrom(), | |
Editor.GetSelectLineTo(), Editor.GetSelectColmTo()]; | |
Editor.CancelMode(0); | |
return ret; | |
} | |
} | |
// ------------------------------------------------------------------------------------ | |
// 行入れ替え(下) | |
// ------------------------------------------------------------------------------------ | |
function moveDown(cursorPosition){ | |
// 入れ替えを受ける行の内容を取得 | |
Editor.MoveCursorLayout(cursorPosition[2]+1,1,0); | |
var str1 = Editor.GetLineStr(0); | |
// 入れ替えを試みる側の内容を取得。選択中の場合は選択範囲が含まれる全行が対象 | |
Editor.MoveCursorLayout(cursorPosition[0],1,0); | |
Editor.BeginSelect(); | |
for (var i=-1 ; i<cursorPosition[2]-cursorPosition[0] ; i++){ | |
Editor.Down(); | |
} | |
var str2 = Editor.GetSelectedString(0); | |
// カーソルを入れ替え先に移動 | |
Editor.MoveCursorLayout(cursorPosition[0],1,0); | |
// 入れ替え先、入れ替え内容ともに選択 | |
Editor.MoveCursorLayout(cursorPosition[2]+2,1,1); | |
// 入れ替えた文字列を挿入 | |
Editor.InsText(str1+str2); | |
} | |
// ------------------------------------------------------------------------------------ | |
// カーソル/選択状態の復旧 | |
// ------------------------------------------------------------------------------------ | |
function repair(cursorPosition){ | |
Editor.MoveCursorLayout(cursorPosition[0],cursorPosition[1],0); | |
if((cursorPosition[0]!=cursorPosition[2])||(cursorPosition[1]!=cursorPosition[3])){ | |
Editor.MoveCursorLayout(cursorPosition[2],cursorPosition[3],1); | |
} | |
} | |
// ------------------------------------------------------------------------------------ | |
// main | |
// ------------------------------------------------------------------------------------ | |
(function(){ | |
// 読み取り専用の場合は動作しない | |
if (getOpenMode() == "r") return; | |
// カーソル位置情報 | |
var cursorPosition = getCursorPosition(); | |
//Editor.SetDrawSwitch(0); | |
// 選択範囲が最後の行 or EOF行を含んでいる場合、動作しない | |
if (cursorPosition[2] >= Editor.GetLineCount(0)) return; | |
moveDown(cursorPosition); | |
// cursorPositionの行番号を置換後の値に更新 | |
cursorPosition[0] = cursorPosition[0]+1; | |
cursorPosition[2] = cursorPosition[2]+1; | |
repair(cursorPosition); | |
//Editor.SetDrawSwitch(1); | |
Editor.ReDraw(); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//キーボードマクロのファイル | |
S_ReplaceAll('(\s){2}\s+', '\t', 1084); // | |
S_ReDraw(0); // 再描画 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//キーボードマクロのファイル | |
(function(){ | |
var startTarget = '^(?!.*' | |
var endTarget = ').*$' | |
var targetStr = vbsInputBox("指定した文字の無い行を削除します。\n^(?!.*XXX).+$ ←XXXの箇所に下記文字が入ります。!","","" ); | |
if(targetStr == undefined) return; | |
Editor.ReplaceAll(startTarget + targetStr + endTarget , '', 1084); // 2は正規表現 | |
Editor.ReDraw(0); // 再描画 | |
})(); | |
//VBScriptでinputboxを呼び出す | |
function vbsInputBox(prompt, title, _default) { | |
var sc = new ActiveXObject("ScriptControl"); | |
sc.Language = "VBScript"; | |
sc.AddCode( | |
"Function VbsInputBox(prompt, title, default)\n" + | |
" VbsInputBox = InputBox(prompt, title, default)\n" + | |
" End Function\n" | |
); | |
return sc.Run("VbsInputBox", prompt, title, _default ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//キーボードマクロのファイル | |
S_ReplaceAll('^(\\r\\n|\\n|\\r)', '', 1084); // | |
S_ReDraw(0); // 再描画 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var WSHShell = new ActiveXObject("WScript.Shell"); // デバックのためのメッセージボックスを表示する機能 | |
NEWLINE = '\r\n'; | |
var selectString = GetSelectedString(0).replace(/\r\n|\r/g, '\n'); | |
if (selectString === '') { | |
WSHShell.Popup("文字を選択してください。 ", 0, "エラー", 1); | |
} else { | |
selectAll(); | |
var getEditerString = GetSelectedString(0).replace(/\r\n|\r/g, '\n'); | |
var getEditerArray = getEditerString.split('\n'); | |
// 空の行を削除 | |
for (var i = getEditerArray.length - 1; i >= 0; i--) { | |
if (getEditerArray[i].indexOf(selectString) != -1) { | |
// getEditerArray.splice(i, 1); | |
getEditerArray[i] = ""; | |
} | |
} | |
var outPutString = getEditerArray.join(NEWLINE); | |
insText(outPutString); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ************************************************* | |
// SearchWordsPlus.js (Ver.2) | |
// | |
// 環境 : sakura2.0.6.0以降専用 | |
// 機能 : 複数の単語で単語検索を行う | |
// 使用例: Ctrl+ダブルクリック に割り当てする。 | |
// ダブルクリックに[Macro/投稿/116]の割り当て。 | |
// 設定>タイプ別設定>カラー にて | |
// 検索文字列~5 の色を設定しておくこと。 | |
// ************************************************* | |
var strNewWord ; | |
var strLastWords ; | |
var strSearchWords ; | |
// -- 単語を選択 -- | |
//Editor.SelectWord() ; | |
//<- マクロを Ctrl+ダブルクリックにアサインした場合、 | |
// 「Ctrl+左クリック」の時点で既に単語選択されるため、 | |
// ここはコメントアウトしてください。 | |
// -- 選択単語を追加する -- | |
strNewWord = Editor.GetSelectedString(0); | |
if ( strNewWord == "" ){ | |
// -- 単語が存在しない場所で起動した場合はクリアする -- | |
Editor.SearchClearMark(0); | |
//Editor.SetCookie( "window", "SearchWords",""); /*サクラエディタ 2.0.4.0でエラー*/ | |
Editor.SetClipboard(0,""); /* 上記の代替 */ | |
} else { | |
// -- 単語を"SearchWords"というCookieに保存し、複数単語検索する -- | |
//strLastWords = Editor.GetCookie( "window", "SearchWords", "" ); /*サクラエディタ 2.0.4.0でエラー*/ | |
strLastWords = Editor.GetClipboard(0); /* 上記の代替 */ | |
if ( strLastWords.indexOf("##_") == 0 ){/* タグが含まれるか判断 */ | |
/* タグ文字が含まれる場合 */ | |
var TagWordCut = strLastWords.split("##_"); /* タグ文字を取り外す */ | |
strSearchWords = TagWordCut[1] + " " + strNewWord; | |
Editor.Left(); | |
Editor.SearchNext( strSearchWords, 2051 ); | |
var saveWord = "##_" + strSearchWords; /*タグ文字づけ*/ | |
//<- 2051 = 0x01+0x02+0x800 (単語単位+英大小区別+履歴非登録) | |
//Editor.SetCookie( "window", "SearchWords", strSearchWords ); /*サクラエディタ 2.0.4.0でエラー*/ | |
Editor.SetClipboard(0,saveWord); /* 上記の代替 */ | |
}else{ | |
/* タグ文字が含まれない場合(初回起動時) */ | |
Editor.Left(); | |
Editor.SearchNext( strNewWord, 2051 ); | |
//<- 2051 = 0x01+0x02+0x800 (単語単位+英大小区別+履歴非登録) | |
//Editor.SetCookie( "window", "SearchWords", strSearchWords ); /*サクラエディタ 2.0.4.0でエラー*/ | |
var saveWord = "##_" + strNewWord; /*タグ文字づけ*/ | |
Editor.SetClipboard(0,saveWord); /* 上記の代替 */ | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// var WSHShell = new ActiveXObject("WScript.Shell"); // デバックのためのメッセージボックスを表示する機能 | |
NEWLINE = '\r\n'; | |
selectAll(); | |
var getString = GetSelectedString(0).replace(/\r\n|\r/g, '\n'); | |
var getTextArray = getString.split('\n'); | |
var dic = {}; | |
// 重複した位置を探索 | |
for (i = 0; i < getTextArray.length; i++) { | |
var checkStr = getTextArray[i]; | |
if (checkStr === '') {} else { | |
if (dic[checkStr] === undefined) { // 入力文字をキーとして連想配列を作成されているかチェック | |
dic[checkStr] = []; // 1回目の文字であるため連想配列に配列を作成 | |
dic[checkStr].push(i); // 現在の行のインデックスを保持 | |
} else { // 重複した行を発見 | |
dic[checkStr].push(i); // 重複した行のインデックスを保持 | |
} | |
} | |
} | |
// 重複した行の文字を空にする | |
for (var dicKey in dic) { | |
if (dic[dicKey].length > 1) { | |
for (i = 1; i < dic[dicKey].length; i++) { | |
// WSHShell.Popup("dic[dicKey][i]: " +dic[dicKey][i] , 0, "title", 1); | |
getTextArray[dic[dicKey][i]] = ''; // 重複したインデックス位置の文字を削除 | |
} | |
} | |
} | |
// 空の行を削除 | |
//for (var i = getTextArray.length - 1; i >= 0; i--) { | |
// if (getTextArray[i] === '') { | |
// getTextArray.splice(i, 1); | |
// } | |
//} | |
var outPutString = getTextArray.join(NEWLINE); | |
insText(outPutString); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// var WSHShell = new ActiveXObject("WScript.Shell"); // デバックのためのメッセージボックスを表示する機能 | |
NEWLINE = '\r\n'; | |
selectAll(); | |
var getString = GetSelectedString(0).replace(/\r\n|\r/g, '\n'); | |
var getTextArray = getString.split('\n'); | |
var dic = {}; | |
// 重複した位置を探索 | |
for (i = 0; i < getTextArray.length; i++) { | |
var checkStr = getTextArray[i]; | |
if (checkStr === '') {} else { | |
if (dic[checkStr] === undefined) { // 入力文字をキーとして連想配列を作成されているかチェック | |
dic[checkStr] = []; // 1回目の文字であるため連想配列に配列を作成 | |
dic[checkStr].push(i); // 現在の行のインデックスを保持 | |
} else { // 重複した行を発見 | |
dic[checkStr].push(i); // 重複した行のインデックスを保持 | |
} | |
} | |
} | |
// 重複した行の文字を空にする | |
for (var dicKey in dic) { | |
if (dic[dicKey].length > 1) { | |
for (i = 0; i < dic[dicKey].length; i++) { | |
// WSHShell.Popup("dic[dicKey][i]: " +dic[dicKey][i] , 0, "title", 1); | |
getTextArray[dic[dicKey][i]] = ''; // 重複したインデックス位置の文字を削除 | |
} | |
} | |
} | |
// 空の行を削除 | |
//for (var i = getTextArray.length - 1; i >= 0; i--) { | |
// if (getTextArray[i] === '') { | |
// getTextArray.splice(i, 1); | |
// } | |
//} | |
var outPutString = getTextArray.join(NEWLINE); | |
insText(outPutString); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment