Skip to content

Instantly share code, notes, and snippets.

View liuxd's full-sized avatar
🗿
Hi, there.

Allen Liu liuxd

🗿
Hi, there.
  • Tax Traders
  • Auckland, New Zealand
View GitHub Profile
@liuxd
liuxd / 点我.bat
Last active September 7, 2017 01:44
[Click me] 帮老婆偷懒的脚本。
@echo off
set "month=%date:~5,2%"
set "day=%date:~8,2%"
set "tmp=result.tmp"
set "result=%month%月%day%日大大集团各省市新闻稿.txt"
set "html=%result%.html"
if exist %tmp% del %tmp%
@liuxd
liuxd / export_excel.rb
Last active September 7, 2017 01:34
[export_excel.rb] 帮老婆做报表导出Excel的脚本。【大大集团】
#!/usr/bin/env ruby
require 'pathname'
require 'spreadsheet'
require 'roo'
def main resource_path = '', month = 1
data = {}
res = collect resource_path
@liuxd
liuxd / Win2unix.rb
Last active September 7, 2017 01:35
[Win2unix.rb] Replace the windows' line breaks into unix line breaks.
# -*- encoding : utf-8 -*-
module Win2unix
@@file_list = []
def self.tidy path, ext = 'txt'
get_all_files path, ext
@@file_list.each do |file|
handle file
@liuxd
liuxd / index.php
Last active November 8, 2018 21:52
Web Ladder
<?php
namespace ladder;
class Ladder
{
public function main()
{
$sURL = $this->getURL();
@liuxd
liuxd / currency_rate_monitor.rb
Last active September 7, 2017 01:33
[currency_rate_monitor.rb] Monitoring NZD rate and notify you while the rate drops down the limit you set.
#!/usr/bin/env ruby
require 'net/http'
require 'nokogiri'
# Get the rate data from boc page.
def getRate
url = 'http://www.boc.cn/sourcedb/whpj/'
data = Nokogiri::HTML.parse(Net::HTTP.get(URI(url)))
<?php
class Excel_Export
{
/**
* Excel 标题
*
* @type: Array
*/
private $_titles = array();
@liuxd
liuxd / PHP_Spider.php
Last active September 7, 2017 01:26
[Gif Spider] Fetch the Gif images on the page of http://www.ik123.com/q/tuku/gaoxiao/.
<?php
require __DIR__ . 'vendor/autoload.php';
define('IMG_FOLDER', '/tmp/img/');
function show($msg)
{
echo $msg, PHP_EOL;
}
@liuxd
liuxd / SignGenerator.java
Last active September 7, 2017 01:28
[SignGenerator] 生成API签名算法。
import javax.xml.bind.DatatypeConverter;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class SignGenerator
{
public static void main(String a[])
{
// Demo
@liuxd
liuxd / mp3_url_list.txt
Last active September 7, 2017 01:31
[laravelpodcast] Download all mp3 files on http://www.laravelpodcast.com/episodes and rename them in right order.
http://audio.simplecast.com/46453.mp3
http://audio.simplecast.com/42491.mp3
http://audio.simplecast.com/41169.mp3
http://audio.simplecast.com/38785.mp3
http://audio.simplecast.com/35051.mp3
http://audio.simplecast.com/32762.mp3
http://audio.simplecast.com/27610.mp3
http://audio.simplecast.com/25906.mp3
http://audio.simplecast.com/24121.mp3
http://audio.simplecast.com/22314.mp3
@liuxd
liuxd / convert.sh
Last active September 7, 2017 01:35
[convert.sh] 将一个目录下所有文本文档转换为utf8编码。
#!/bin/bash
DIR=$1
find $DIR | while read f;do
if [ -d $f ];then
continue
fi