Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View KEINOS's full-sized avatar

KEINOS KEINOS

View GitHub Profile
@KEINOS
KEINOS / md5.gs
Last active March 20, 2024 04:05
GAS(Google Apps Script) user function to get MD5 hash or 4digit shortened hash for Multibyte(UTF-8, 2bytes character) environment.
/**
* ------------------------------------------
* MD5 function for GAS(GoogleAppsScript)
*
* You can get a MD5 hash value and even a 4digit short Hash value of a string.
* ------------------------------------------
* Usage1:
* `=MD5("YourStringToHash")`
* or
* `=MD5( A1 )`
@KEINOS
KEINOS / fArray_merge.php
Last active May 29, 2017 21:42
PHPで添え字付き多次元配列を結合するための関数
<?php
function fArray_merge($aOld, $aNew)
{
if (is_array($aOld)) {
if (is_array($aNew)) {
foreach ($aNew as $sKey => $mValue) {
if (isset($aOld[$sKey]) && is_array($mValue) && is_array($aOld[$sKey])) {
$aOld[$sKey] = fArray_merge($aOld[$sKey], $mValue);
} else {
$aOld[$sKey] = $mValue;
@KEINOS
KEINOS / log_error_minecraft_launcher-helper_20170603.log
Created June 3, 2017 12:59
Crash report (error log) of "Minecraft Launcher Helper" on macOS Sierra (OSX 10.12.5)
「launcher Helperの問題レポート」
「launcher Helperが予期しない理由で終了しました。」(Minecraft Launcher quit unexpectedly.)
-----
Process: launcher Helper [83464]
Path: /Applications/Minecraft.app/Contents/Frameworks/launcher Helper.app/Contents/MacOS/launcher Helper
Identifier: com.mojang.mclauncher.helper
Version: ???
Code Type: X86-64 (Native)
Parent Process: launcher [83459]
Responsible: launcher Helper [83464]
@KEINOS
KEINOS / bashrc_Apple_Terminal.sh
Last active June 5, 2017 21:50
[IN PROGRESS] Bash file's comments translation in Japanese at '/etc/bashrc_Apple_Terminal'. [macOS Sierra( OSX 10.12 )]
# bashの「ターミナル」対応
# 作業ディレクトリ(ワーキング・ディレクトリ)
#
# ターミナルに現在の作業ディレクトリを、プロンプトごとに伝える
if [ -z "$INSIDE_EMACS" ]; then
update_terminal_cwd() {
# "file:"のURLスキームを使ってディレクトリを特定する。
@KEINOS
KEINOS / function.checkDigit.php
Last active June 11, 2017 15:16
JANコード(バーコード)のチェック・デジット算出用PHP関数。Simple function that returns the check digit for JAN, ITF, UCP code. About JAN code see: http://www.dsri.jp/jan/check_digit.html
<?php
/**
* Returns the check sum digit according to JAN code regulation.
* About JAN code : http://www.dsri.jp/jan/check_digit.html
*
* @param {string} $s number or string
* @return {integer} One digit number
*/
function checkDigit( $s ){
$a = array_merge( array(0), array_map( function($v){ return is_numeric( $v ) ? $v : bin2hex($v); }, str_split( $s )));
@KEINOS
KEINOS / Sample.php
Last active July 19, 2017 17:03
Simple PHP function to encode decimal numbers to Nth base.
<?php
mb_internal_encoding('UTF-8');
include_once('mb_base_encode.php');
// Input string
$s = 'This is a sample string to be hashed.';
// Output
echo $s . PHP_EOL; // 'This is a sample string to be hashed.'
echo md5($s) . PHP_EOL; // 'baad33e1e97f316b9750c27c86bf64d6'
@KEINOS
KEINOS / File1
Last active June 12, 2017 12:45
配列のように、SQLite3クラスを使用するためのシンプルなクラスです。Simple class for use of the SQLite3 class, as easy like an array.
<?php
/* =========================================================================
Sample usage
of
KEINOS_DB class
https://gist.github.com/KEINOS/873269390bc6c9c0cb724dd52170ea9f
========================================================================= */
// Flag for debugging. Nothing important for the sample. See `debug_echo`
@KEINOS
KEINOS / Main.vb
Last active June 12, 2017 13:02
Sample VB script function to get MD5 hash value from a string.
public class compiler
' See sample work at
' https://paiza.io/projects/uoJ2-cB4Os76jMK-O11Csw
shared function Main as integer
' MD5ハッシュ値を計算したい文字列
Dim s As String = "sample text"
' MD5の結果を表示
Console.WriteLine ( md5( s ) )
@KEINOS
KEINOS / log_error_centOS7_mastodon_rake_secret.log
Last active June 17, 2017 06:28
Error log of `rake secret` on CentOS7 while installing Mastodon. If you're getting this error try `$ RAILS_ENV=production bundle exec rake secret` to get the secret key.
[mastodon@myserver live]$ export SECRET_KEY_BASE=$(bundle exec rake secret)
rake aborted!
NameError: uninitialized constant Annotate
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:53:in `block in load_missing_constant'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:11:in `block in with_bootsnap_fallback'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:17:in `without_bootsnap_cache'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:11:in `rescue in with_bootsnap_fallback'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:6:in `with_bootsnap_fallback'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/ac
@KEINOS
KEINOS / log_error_centOS7_mastodon_rails_db_setup.log
Created June 16, 2017 16:44
Error log of CentOS7 while installing mastodon when `rails db:setup`
[mastodon@myserver live]$ RAILS_ENV=production bundle exec rails db:setup
Database 'mastodon' already exists
rails aborted!
Devise.secret_key was not set. Please add the following to your Devise initializer:
config.secret_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
Please ensure you restarted your application after installing Devise or setting the key.
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/devise-4.3.0/lib/devise/rails/routes.rb:498:in `raise_no_secret_key'
/home/mastodon/live/vendor/bundle/ruby/2.4.0/gems/devise-4.3.0/lib/devise/rails/routes.rb:226:in `devise_for'