Skip to content

Instantly share code, notes, and snippets.

View xcaptain's full-sized avatar

Joey xcaptain

View GitHub Profile
@xcaptain
xcaptain / create_table
Created April 23, 2014 15:52
爬取搜狐页面的爬虫,获得视频播放页的url
create table tv_info(
id int auto_increment primary key,
url varchar(150),
type tinyint(2),
title varchar(50),
comment varchar(100),
status tinyint(2));
@xcaptain
xcaptain / 360_star.py
Created January 12, 2015 16:28
采集360整理的部分明星信息的脚本
#!/usr/bin/python
# -*-coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
import pinyin
import mysql.connector
import sys
count_index = 0
@xcaptain
xcaptain / PointTest.php
Last active April 14, 2016 09:10
用guzzle和phpunit测试基于mongo应用的聊天服务的性能
<?php
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Client;
use GuzzleHttp\Pool;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
class PointTest extends PHPUnit_Framework_TestCase
{
@xcaptain
xcaptain / testHash.txt
Created July 7, 2016 03:38
test laravel hash function
php artisan key:generate
php artisan tinker
$plain = '123456';
$hashed = app('hash')->make('123456')
app('hash')->check($plain, $hashed)
php artisan key:generate
app('hash')->check($plain, $hashed)
@xcaptain
xcaptain / multi_process_csv_task.php
Created September 17, 2016 15:44
multi process php script to write csv file
<?php
class Task
{
private $data = [];
private $fp = null;
private $columns = ['id', 'amount', 'date'];
@xcaptain
xcaptain / roll_news_qq_spider.php
Created September 18, 2016 06:12
用php抓取roll.news.qq.com的内容
<?php
class RollNewsSpider
{
private $url = 'http://roll.news.qq.com/interface/roll.php';
public function run()
{
$data = $this->getJsonData();
@xcaptain
xcaptain / .php_cs
Created October 14, 2017 10:47
php-cs-fixer config
<?php
$excluded_folders = [
'node_modules',
'storage',
'vendor',
'bootstrap/cache',
];
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude($excluded_folders)
@xcaptain
xcaptain / typescript_axios_async_request.ts
Created November 6, 2017 16:39
使用typescript + axios异步发送请求
import axios from 'axios';
async function getBaidu() {
return axios.get('http://www.baidu.com');
}
async function getBing() {
return axios.get('http://www.guazi.com');
}
@xcaptain
xcaptain / dianping_downloader.ts
Created November 12, 2017 10:15
用typescript+puppeteer写的点评网页下载脚本
import * as puppeteer from 'puppeteer';
import * as fs from 'fs';
/**
* 使用typescript实现一个点评页面爬虫
*/
class DianpingDownloader {
private urls;
/**
@xcaptain
xcaptain / README-Template.md
Created December 31, 2017 05:48 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites