Skip to content

Instantly share code, notes, and snippets.

View teramako's full-sized avatar

teramako teramako

View GitHub Profile
@teramako
teramako / README.md
Last active January 28, 2024 09:50
MySQL caching_sha2_password fast-path Test

MySQL caching_sha2_password fast-path Test

Usage

python3 thisScript.py arg1 arg2

  arg1: Server password
  arg2: Client password
@teramako
teramako / mysql_certs.mk
Last active July 1, 2023 16:07
Generate Certificates for MySQL
#
# Generate Certificates for MySQL
#
DIGEST := sha512
KEY_LEN := 2048
EXPIRE := 90
CA_KEY := ca-key.pem
CA_CERT := ca.pem
CA_SUBJECT := "/CN=MySQL CA"
@teramako
teramako / perm2oct.sed
Last active September 7, 2022 13:03
rwxなパーミッションを8進数表記に変換するsedスクリプト。 ls -l | sed -f perm2oct.sed
#!/usr/bin/sed -f
# SUID, GUID, Sticky-bit
s/^\(.\)\(..[sS]..[sS]..[tT]\)/\17\2/; t perm
s/^\(.\)\(..[sS]..[sS]..[^tT]\)/\16\2/; t perm
s/^\(.\)\(..[sS].\{5\}[tT]\)/\15\2/; t perm
s/^\(.\)\(..[sS][^sStT]\{6\}\)/\14\2/; t perm
s/^\(.\)\([^sS]\{5\}[sS]..[tT]\)/\13\2/; t perm
s/^\(.\)\([^sS]\{5\}[sS][^tT]\{3\}\)/\12\2/; t perm
s/^\(.\)\([^sS]\{8\}[tT]\)/\11\2/; t perm
@teramako
teramako / ex-generator.js
Last active July 5, 2022 08:40
Generatorの拡張
const iter = (function(){
// 元のGenerator.prototype
const GeneratorProto = ({*g(){}}).g().constructor.prototype;
// 拡張してmap,filterを付与したprototype
const ExtendedGeneratorProto = Object.setPrototypeOf({
map (func, thisArg = null) {
const iterable = this;
return Object.setPrototypeOf(function*() {
var i = 0;
for (const item of iterable) {
@teramako
teramako / cmds.yml
Created December 19, 2020 09:22
ansible-playbook simple_cmds.yml -e @cmds.yml
## this is sample
COMMANDS:
- |
id
uname -n
date
- cat /path/to/file
ADMIN: true
@teramako
teramako / config.json
Last active September 13, 2020 13:39
pecoで ls -l の結果からファイル名部分のみを検索できるようにCustomFilterを設定
{
"CustomFilter": {
"ls-l": {
"Cmd": "perl",
"Args": ["/Users/teramako/bin/ls-l-filter.pl", "$QUERY"],
"BufferThreshold": 100
}
}
}
@teramako
teramako / extendGeneratorPrototype.js
Last active September 18, 2016 16:09
Generatorのプロトタイプ拡張。ま、やっつけです。
/* Usage
function * gene() {
console.log("iter");
yield 1;
console.log("iter");
yield 2;
console.log("iter");
yield 3;
}
var result = gene
@teramako
teramako / join.vba
Created June 27, 2016 06:14
Excel VBAの標準モジュールに追加してる関数
' ="SELECT ..... FROM ... WHERE column_A in ("&join(A1:A10,",","'")&")" などと式に使うことを想定
' SQLインジェクション可能だが知らん。
Function join(r As Range, Optional delimiter As String = ",", Optional wrap As String = "'") As String
Dim i As Integer
Dim result = As String
result = wrap & r.Cells(1, 1).Value & wrap
For i = 2 To r.rows.Count
@teramako
teramako / gist:a076cedcaebcc70252bf
Last active August 29, 2015 14:17
今日ダウンロードしたzipファイル。
$ file HOGEHOGE.zip
HOGEHOGE.zip: Bourne-Again shell script text executable
$ strings HOGEHOGE.zip
#!/bin/bash
sed -e '1,/BIGIN HOGEHOGE/d' $0 |sed -e '1,/BIGIN HOGEHOGE/d' > ./test.tar.gz
tar zxvf test.tar.gz >/dev/null;
chown root aFile bFile cFile
chmod 4755 aFile bFile cFile
exit 0
#BIGIN HOGEHOGE

ECMAScript6th Quiz Answer

Answer of ES6 Quiz

A.1

  • 2 "func"

see: [9.2.12 SetFunctionName][9.2.12], [12.14.4 Runtime Semantics of AssignmentExpression][12.14.4]