Skip to content

BowenSun90/code-in-action

Repository files navigation

code-in-action

Sample projects for various language in programing

[toc]

1.springboot

The Best APIs
https://swagger.io/

配置文件 application.properties

# spring application config
spring.application.name=webservice-template
spring.profiles.active=${spring.profiles.active}
server.context-path=/
server.port=${port}

# mybatis mapper config
mybatis.mapper-locations=classpath*:mapper/**Mapper.xml

# guava memory cache config
guava.cache.maximumSize=1000
guava.cache.duration=1
# DAYS |HOURS |MINUTES |SECONDS |MILLISECONDS |MICROSECONDS |NANOSECONDS
guava.cache.unit=DAYS

数据库配置 application-{spring.profiles.active}.properties

spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://${host}:${port}/${database}
spring.datasource.username=${username}
spring.datasource.password=${password}

spring.datasource.max-idle=50
spring.datasource.max-wait=10000
spring.datasource.min-idle=10
spring.datasource.initial-size=10

启动类
WebserviceApplication

Profile
DEV:使用内嵌Tomcat容器启动
PROD:不打包内嵌Tomcat,打包为war放到Jetty中启动
pom.xml

Swagger APIs
SwaggerConfig

Guava memory cache
UserService

2.Python爬虫

  • 2.1 Python scrapy sample program
    tutorial
> cd tutorial
> scrapy crawl quotes
  • 2.2 拉勾网职位信息
    lagou
> cd lagou
> scrapy crawl lagouposition
> head ./lagou.csv
> cd doubanbook
> scrapy crawl dbbook
> head ./douban.csv
> cd citycode
> scrapy crawl city
> head ./city.csv
> cd hospitalcrawler
> scrapy crawl hospital
> head ./hospital.csv
> cd schoolcrawler
> scrapy crawl school
> head ./school.csv

3.Python

4.Storm

5.Flink

6.HBase

7.Quartz

8.GRPC