Skip to content

Instantly share code, notes, and snippets.

@alexpacer
alexpacer / mongod-config
Created December 21, 2017 01:42
Mongodb config server startup script on CentOS: "/etc/rc.d/init.d/mongod-config"
#!/bin/sh
#
# mongodb Startup script for the mongodb _config_ server
#
# chkconfig: - 64 36
# description: MongoDB Database Configuration Server
# processname: mongodb
#Source function library
. /etc/rc.d/init.d/functions
@alexpacer
alexpacer / encryption_service.rb
Last active April 29, 2022 00:48
智付通付款 payload 加密
require 'digest/sha2'
require 'base64'
require 'mcrypt' # 需要 php5-mcrypt libmcrypt-dev libmcrypt
class EncryptionService
prepend SimpleCommand # 可在 rails controller 簡單呼叫這個 library 的 plugin
def initialize(payload) # 將前台的動態資訊組好後丟進來
@payload = payload
end
@alexpacer
alexpacer / followup_betting.rb
Last active August 29, 2017 01:44
The Sample script of producing followup betting
# -*- coding: utf-8 -*-
require 'optparse'
require 'bigdecimal'
class FollowupBetting
@@price = 5.98 # 賠率
@@bet_amt = 2 # 注金
@@init_multiplier = 1 # 起始倍率
@@spending = 0
@@amt_spent = 0 # 累計投入