Skip to content

Instantly share code, notes, and snippets.

@alexpacer
alexpacer / mongod-config
Created Dec 21, 2017
Mongodb config server startup script on CentOS: "/etc/rc.d/init.d/mongod-config"
View 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 Apr 29, 2022
智付通付款 payload 加密
View encryption_service.rb
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 Aug 29, 2017
The Sample script of producing followup betting
View followup_betting.rb
# -*- coding: utf-8 -*-
require 'optparse'
require 'bigdecimal'
class FollowupBetting
@@price = 5.98 # 賠率
@@bet_amt = 2 # 注金
@@init_multiplier = 1 # 起始倍率
@@spending = 0
@@amt_spent = 0 # 累計投入