Skip to content

Instantly share code, notes, and snippets.

View silverskyvicto's full-sized avatar
🏢
Work

Yuuki Ebihara silverskyvicto

🏢
Work
  • Ricksoft Co., Ltd.
  • Japan
View GitHub Profile
Map<String, String> typeLabelMap = new Map<String, String>{
'ANYTYPE' => '任意のデータ型',
'BASE64' => 'BASE64のバイナリデータ型',
'BOOLEAN' => 'チェックボックス',
'COMBOBOX' => 'コンボボックス',
'CURRENCY' => '通貨',
'DATACATEGORYGROUPREFERENCE' => 'データカテゴリグループ',
'DATE' => '日付',
'DATETIME' => '日付/時刻',
'DOUBLE' => '浮動小数点値',
@silverskyvicto
silverskyvicto / GetTabInfo.cls
Created July 9, 2016 18:18
Get Tab information using Apex.
List<Schema.DescribeTabSetResult> tabSetDesc = Schema.describeTabs();
Map<String, Schema.SObjectType> smap = Schema.getGlobalDescribe();
System.debug(
'カラーテーマ' + '\t'
+ 'カラーコンテキスト' + '\t'
+ 'タブの表示ラベル' + '\t'
+ '使用オブジェクト名' + '\t'
+ 'カスタムタブかどうか'
);
@silverskyvicto
silverskyvicto / file0.txt
Created September 18, 2016 16:32
Homebrewが突然エラーを出すようになった時の対処 ref: http://qiita.com/silverskyvicto/items/4b87ceaad3f526a958b9
MBAEY:~ ey$ brew update
mkdir: /usr/local/var/homebrew/locks: Permission denied
/usr/local/Library/Homebrew/utils/lock.sh: line 19: /usr/local/var/homebrew/locks/update: No such file or directory
-e:1:in `initialize': Bad file descriptor (Errno::EBADF)
from -e:1:in `new'
from -e:1:in `<main>'
Error: Another active Homebrew process is already in progress.
Please wait for it to finish or terminate it to continue.
@silverskyvicto
silverskyvicto / EmojiRemove.py
Created February 15, 2017 17:24
EmojiRemove.py
# #!/usr/bin/env python
# xmlファイル内の絵文字除去用スクリプト
import sys
import re
# チェック元ファイル
f = open(sys.argv[1])
# 絵文字除去後のファイル
new_file = open('EmojiRemovedFile.xml', 'a')

Symmetric Encryption

The only way to encrypt today is authenticated encryption, or "AEAD". ChaCha20-Poly1305 is faster in software than AES-GCM. AES-GCM will be faster than ChaCha20-Poly1305 with AES-NI. Poly1305 is also easier than GCM for library designers to implement safely. AES-GCM is the industry standard.

Use, in order of preference:

  1. The NaCl/libsodium default
import os
import sys
import re
import csv
# 行の区切り文字
# separator = os.linesep
pref_pattern = r"^([^市区町村]{2}[都道府県]|[^市区町村]{3}県)"
city_pattern = r"^(余市郡(仁木町|赤井川村|余市町)|余市町|柴田郡村田町|(武蔵|東)村山市|[東西北]村山郡...?町|田村(市|郡..町)芳賀郡市貝町|(佐波郡)?玉村町|[羽大]村市|(十日|大)町市|(中新川郡)?上市町|(野々|[四廿]日)市市|西八代郡市川三郷町|神崎郡市川町|高市郡(高取町|明日香村)|(吉野郡)?下市町|(杵島郡)?大町町)"
re_pref_pattern = re.compile(pref_pattern)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import re
# 除去対象の制御文字を正規表現で設定
ascii = r'[\x00-\x1f\x7f]'
reg_ascii = re.compile(ascii)
@silverskyvicto
silverskyvicto / create_ascii_control_file.py
Last active August 18, 2017 16:03
Script for creating file including ascii control character. for test
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
ascii_controls = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x7f]
try:
output = open(sys.argv[1], 'w')
@silverskyvicto
silverskyvicto / file0.txt
Created November 14, 2017 11:51
PostgreSQL のログイン時にパスワードを省略する方法 ref: https://qiita.com/silverskyvicto/items/0909d698526779d975f5
## .pgpassファイルを作成
# vi .pgpass
## 次の内容を記載
<DBサーバのホスト名>:<DBサーバのポート>:<データベース名>:<ユーザ名>:<パスワード>
# 記載したら保存する
## 権限を以下のコマンドで変更する
# chmod 600 .pgpass
# coding: UTF-8
import sys
import json
list_name = sys.argv[1]
with open(list_name, "r") as fList:
file_name = fList.readline().replace('\n', '')
input_str = ""