Skip to content

Instantly share code, notes, and snippets.

View KEINOS's full-sized avatar

KEINOS KEINOS

View GitHub Profile
@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 / 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_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'
@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 / RictyDiminishedDiscord-Regular.css
Last active June 25, 2017 10:07
Sample CSS to use "Ricty Diminished" fonts installed in your Mac OSX.
<style type="text/css">
.debug {
width:100%;
font-size:16px;
/* See the PostScriptName of the font info at FontBook app */
font-family:"RictyDiminishedDiscord-Regular";
overflow: auto;
white-space: pre-wrap;
word-wrap: break-word;
}
@KEINOS
KEINOS / KEINOS' PHP classes and functions.md
Last active June 27, 2017 17:03
KEINOSのSourceforge,GoogleCodeなどで管理していた汎用クラスやユーザー関数です。

目次

Class一覧

  • class.cColor.php : CSSなどで、色味を統一させるために、色相を保ったまま、明度の変更、色の混合、色の強調、ウェエブセーフカラーなどに変換するクラスです。

Function一覧

  • function.file_get_googletext.php : 一般公開されたGoogle文書をSmartyなどのテンプレート・エンジンのテンプレートとして使うために、テキストの文字列として返す関数。
@KEINOS
KEINOS / mastodon-installer-for-centos7.x-at-SakuraCloud.sh
Last active July 3, 2017 10:48
Mastodonインスタンスのスタートアップ・スクリプト [Detail: https://cloud-news.sakura.ad.jp/startup-script/mastodon/information/ ][2017/06/17現在][さくらインターネット][さくらのクラウド][CentOS7.3]
#!/bin/bash
#
# @sacloud-once
# @sacloud-desc-begin
# このスクリプトはmastodonをセットアップします。
# (このスクリプトは、CentOS7.Xでのみ動作します。)
#
# 事前作業として以下の2つが必要となります
# ・さくらのクラウドDNSにゾーン登録を完了していること
# ・さくらのクラウドAPIのアクセストークンを取得していること
@KEINOS
KEINOS / 20170718-1-error-full.log
Last active July 18, 2017 08:05
[ERROR LOG] While installing Mondo Rescue on Vanilla CentOS Linux release 7.3.1611 (Core)
[root@ixx-xxx-xxxxx ~]# cd ~/
[root@ixx-xxx-xxxxx ~]#
[root@ixx-xxx-xxxxx ~]# # Update yum skip to line 2838
[root@ixx-xxx-xxxxx ~]# yum -y update
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
epel/x86_64/metalink | 5.0 kB 00:00:00
epel | 4.3 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00