Skip to content

Instantly share code, notes, and snippets.

View moolex's full-sized avatar
🏠
lazying from home

MOYO moolex

🏠
lazying from home
View GitHub Profile
@moolex
moolex / douban.album.download.php
Created January 20, 2013 05:02
豆瓣相册下载(单文件)
<?php
$start = @$_GET['start'];
$start || $start = 0;
$d = file_get_contents('http://www.douban.com/photos/album/20987752/?start='.$start);
preg_match_all('/\/photos\/photo\/(\d{10})\/"/i', $d, $photo_ms);
preg_match_all('/http:\/\/img(\d{1})\.douban\.com\//i', $d, $server_ms);
preg_match_all('/class="photolst_photo" title="(.*?)"/is', $d, $title_ms);
@moolex
moolex / business.php
Last active December 11, 2015 11:28
OOP连贯操作管理
<?php
/**
* 实际业务操作
*/
class business
{
/**
* 操作入口
*/
#!/bin/bash
# supervisor job control
function job()
{
if [ $# -gt 0 ]; then
cmd=$1
else
cmd="status"

Keybase proof

I hereby claim:

  • I am moolex on github.
  • I am moyo (https://keybase.io/moyo) on keybase.
  • I have a public key ASBps2JWwK3Oc5UXfxTfo9T2Eh6xRjjL3F1RPHsUIG9biwo

To claim this, I am signing this object:

@moolex
moolex / php-fpm-cli
Last active December 2, 2016 04:35 — forked from muhqu/php-fpm-cli
#!/bin/bash
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Mathias Leppich <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@moolex
moolex / ss-rules
Last active January 18, 2017 08:19
ss-rules from shadowsocks-libev@openwrt
#!/bin/sh
usage() {
cat <<-EOF
Usage: ss-rules [options]
Valid options are:
-s <server_host> hostname or ip of shadowsocks remote server
-l <local_port> port number of shadowsocks local server
syntax = "proto3";
message Span {
fixed64 traceID = 1;
string spanID = 2;
int64 time = 3;
map<string, string> properties = 4;
@moolex
moolex / tail2nsq.sh
Created April 24, 2017 07:36
Tail files and send to nsq via curl (logs with json)
#!/bin/sh
tail -n0 -f $@ |
grep --line-buffered "" |
while read line;
do
echo $line && curl -s -d "{"$(echo $line | cut -d"{" -f2-) "http://127.0.0.1:4151/pub?topic=local_fs_tails" > /dev/null
done;
@moolex
moolex / Dockerfile
Last active April 25, 2017 04:38
PHP Dockerfile include exts: pdo-mysql,yaml,redis,msgpack,phalcon
FROM php:7-alpine
MAINTAINER Shiyu Han <[email protected]>
# Ext versions
ENV YAML_VER=2.0.0
ENV REDIS_VER=3.1.2
ENV MSGPACK_VER=2.0.2
ENV PHALCON_VER=3.1.2
@moolex
moolex / vpnc-script
Created April 26, 2017 15:03
vpnc-script from openconnect
#!/bin/sh
#
# Originally part of vpnc source code:
# © 2005-2012 Maurice Massar, Jörg Mayer, Antonio Borneo et al.
# © 2009-2012 David Woodhouse <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.