sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot python-certbot-nginx
Running this command will get a certificate for you and have Certbot edit your Nginx configuration automatically to serve it.
sudo certbot --nginx
# for a specific name
sudo certbot --nginx -d example.com
The Certbot packages on your system come with a cron job that will renew your certificates automatically before they expire.
You can test automatic renewal for your certificates by running this command:
sudo certbot renew --dry-run
docker images
docker build -t image_name .
docker rmi $(docker images | grep "^<none>" | awk "{print $3}") # remove all untagged images
docker save image_name > image_name.tar # save image as a tar file
docker load < busybox.tar.gz # load image
docker run -p 27017:27017 -v mongodbdata:/data/db mongo
docker ps -a
docker exec -it ubuntu_bash bash
docker rm container_name
docker rm $(docker ps -a -q) # remove all stopped containers
docker volume create mongodbdata
docker volume ls
docker volume inspect mongodbdata
docker network ls
docker network create network_name
docker network inspect network_name
docker network rm network_name
Sample Code: https://github.com/guangningyu/react-skeleton
wget http://downloads.lightbend.com/scala/2.11.8/scala-2.11.8.rpm
mkdir -p src/main/java/hello
mkdir -p src/test/java/hello
src/main/java/hello/HelloWorld.java
package hello;
import org.joda.time.LocalTime;
public class HelloWorld {
public static void main(String[] args) {
LocalTime currentTime = new LocalTime();
System.out.println("The current local time is: " + currentTime);
Greeter greeter = new Greeter();
System.out.println(greeter.sayHello());
}
}
src/main/java/hello/Greeter.java
package hello;
public class Greeter {
public String sayHello() {
return "Hello world!";
}
}
src/test/java/hello/GreeterTest.java
package hello;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.*;
import org.junit.Test;
public class GreeterTest {
private Greeter greeter = new Greeter();
@Test
public void greeterSaysHello() {
assertThat(greeter.sayHel
> var _ = require('lodash');
> foo
{ a: { num: 1 }, b: { num: 2 }, c: { num: 3 } }
> _.forEach(foo, (vlu, key) => {console.log(vlu, key);})
{ num: 1 } 'a'
{ num: 2 } 'b'
{ num: 3 } 'c'
{ a: { num: 1 }, b: { num: 2 }, c: { num: 3 } }
> foo
{ a: { num: 1 }, b: { num: 2 }, c: { num: 3 } }
> _.pickBy(foo, (i) => i.num>=2)
{ b: { num: 2 }, c: { num: 3 } }
DEFAULT=5
RESULT=${VAR:-$DEFAULT}
function rollback() {
if [[ $? -ne 0 ]]; then
echo "rollback"
fi
}
set -ueo pipefail
trap rollback EXIT
#!/bin/bash
FILE="/etc/passwd"
if [[ -f $FILE ]];then
echo "$FILE exists"
else
echo "$FILE doesn't exist"
fi
#!/bin/bash
DIR="/var/log"
if [[ -d $DIR ]]; then
echo "$DIR exists"
else
echo "$DIR doesn't exist"
fi
function assert_var_exists() {
local condition="[[ ! -n \"\${$1+set}\" ]]"
if eval $condition; then
echo "The variable ${1} does not exist. Exit."
exit 1
fi
}
function export_var() {
assert_var_exists $1
local var_value=$(($1))
eval "export $1=\$var_value"
echo "$1=$var_value"
}
git config --global user.name "Guangning Yu"
git config --global user.email "hi@guangningyu.com"
git remote -v
git remote set-url origin git@github.com:guangningyu flasky.git
git pull origin master
git push origin master
git commit —no-edit
git reset HEAD~
git reset filename.txt
GIT_COMMITTER_NAME='Jane Doe' GIT_COMMITTER_EMAIL='jane@doe.com' git commit —author="John Doe <john@doe.com>" -m "This is authored by John Doe and committed by Jane Doe."
git checkout HEAD path/to/file
git branch -a
git checkout test_branch
git checkout -b [name_of_your_new_branch]
git push -u origi
my_array.slice(-1)[0]
my_array.pop()
#!/usr/bin/env python
import urllib2
import numpy as np
from keras.models import Sequential
from keras.layers import Dense
from keras.wrappers.scikit_learn import KerasRegressor
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import KFold
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
def load_data():
X = []
Y = []
data_url = 'https://archive.ics.uci.edu/ml/machine-learning-databases/housing/housing.data'
for line in urllib2.urlopen(data_url).readlines():
line = map(float, line.split())
X.append(line[0:13])
Y.append(line[13])
return X, Y
def basic_model():
# create model
model = Sequential()
model.add(Dense(13, input_dim=13, kernel_initializer='normal', activation='relu'))
model.add(Dense(1, kernel_initializer='normal'))
# compile model
model.compile(loss='mean_squared_error', optimizer='adam')
return model
d
已逾契约书约定缴款日的延滞天数,贷放型产品自缴款截止日(通常为次一关账日)后第一天开始计算;信用卡比较特别,虽然缴款截止日约为关账日后20天,但逾期天数亦是由次一关账日后起算。
逾期1期称为M1,2期称为M2,3期称为M3……以此类推。信用卡缴款截止日与次一关账日之间虽然不计算逾期天数,但其bucket称为M0。
注意,因为每月天数不一定相同,所以各期的长短会有不同。
依bucket可分为前期(front end)、中期(middle range)、后期(hot core)、转呆账(write-off)。
stage的划分方式并无硬性规定,可依各银行的催收策略、转呆账政策与产品特性决定。以信用卡为例,一般将M1列为前期,M2-M3列为中期,M4以上列为后期,若已转列呆账者则列入转呆账。
即期指标 = 当期各bucket延滞金额 / 当期应收账款
即期指标是计算延滞率时常用的两种方法之一,其概念为分析当期应收帐款的质量结构。一般公开信息所显示的延滞率,若无特别注明,皆是以coincidental的概念计算的。
递延指标 = 当期各bucket延滞金额 / 各bucket对应的历史月份应收帐款
即期指标的分母一律是当期应收账款,不过其分子实际上是由之前的应收账款产生的;因为为了回溯逾期起源,递延指标将分母改成了相对应的之前月份的应收账款。
期末结算为信用卡特有的结算方式。因为信用卡客群最为庞大,作业处理相当耗时,许多银行会将其客户划分至不同账务周期(cycle),因此信用卡产品下通常有多个关账日。
银行必须就各个cycle客户分别管理,尤其是账务及催收单位皆以cycle为作业周期。
月底结算报表主要表达各月月底结算数据,适用于消费金融所有产品,尤其在跨产品并列分析时,为实现资料切点一致,多采用月底结算数据。
参考:《互联网金融时代:消费信贷评分建模与应用》
-- change date format
from_unixtime(unix_timestamp('20150101' ,'yyyyMMdd'), 'yyyy-MM-dd')
-- add n days
date_add('2015-11-01', 30) -- will return '2015-12-01'
-- calculate date difference
datediff('2015-12-01', '2015-11-01') -- will return 30
row_number() over (DISTRIBUTE BY... SORT BY... DESC)
analyze table xxx.yyy partition(dt = '2015-12-11') compute statistics;
describe formated xxx.yyy partition (dt = '2015-12-11');