Skip to content

Instantly share code, notes, and snippets.

View xiangzhuyuan's full-sized avatar
🤗

Mathew P. Jones xiangzhuyuan

🤗
View GitHub Profile
@xiangzhuyuan
xiangzhuyuan / demo.sh
Created June 29, 2017 04:44
check file exist or empty
#!/usr/bin/env bash
pidFile=~/test1
if [ ! -s ${pidFile} ];then
echo 'not exist or empty, touch this file'
touch ${pidFile}
fi
@xiangzhuyuan
xiangzhuyuan / gist:545d879cd75f40e7954795d60b9817ae
Last active June 11, 2017 08:02
try to get list you are following and followers, open the popup layer~
!function(e){e.save=function(o,n){if(!o)return void e.error("Console.save: No data");n||(n="console.json"),"object"==typeof o&&(o=JSON.stringify(o,void 0,4));var t=new Blob([o],{type:"text/json"}),a=document.createEvent("MouseEvents"),s=document.createElement("a");s.download=n,s.href=window.URL.createObjectURL(t),s.dataset.downloadurl=["text/json",s.download,s.href].join(":"),a.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),s.dispatchEvent(a)}}(console);var d=document,b=d.createElement("script");b.src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js",d.getElementsByTagName("head")[0].appendChild(b);var s="";$("div._2uju6").each(function(){s+=$(this).text(),s+="\n"}),console.save(s);
@xiangzhuyuan
xiangzhuyuan / get_your_local_sunrise_sunset.rb
Created March 10, 2017 05:42
Get your local sunrise and sunset time
require 'net/http'
require 'uri'
require 'nokogiri'
require 'byebug'
PREFIX= "https://www.google.co.jp/search?q="
QUERY = "+日の出+日の入り"
@xiangzhuyuan
xiangzhuyuan / repo_info.rb
Created December 1, 2016 00:57
just to fetch your github timeline stats
require 'atom'
require 'json'
require 'uri'
require 'net/http'
API_URL_PREFIX = "https://api.github.com/repos/"
URL_PREFIX = "https://github.com/"
language_stack = {}
language_count = {}
@xiangzhuyuan
xiangzhuyuan / learnigSwift3.swift
Created October 24, 2016 06:26
A tour of swift3
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
print("hello world")
// --
var myVariable = 42
胆振综合振兴局
市部:室兰市、苫小牧市、登别市、伊达市
虻田郡:丰浦町、洞爷湖町
有珠郡:壮瞥町
白老郡:白老町
勇拂郡:安平町、厚真町、鹉川町(原名:むかわ町)
@xiangzhuyuan
xiangzhuyuan / thread.rb
Last active March 15, 2016 07:14
available thread counts?
#
# Returns the number of threads waiting on the queue.
#
def num_waiting
@num_waiting
end
end
# when init EM env, there is a thread pool would be inited
# with default configutation. the `num_waiting` would be set as that value
Circuit_breaker(断路器)
https://en.wikipedia.org/wiki/Circuit_breaker
###马丁说
http://martinfowler.com/bliki/CircuitBreaker.html
###in ruby
@xiangzhuyuan
xiangzhuyuan / gist:6d540a99cc8a1d938ec5
Last active February 26, 2016 07:31
just delete all your weibo by using iMacros
SET !ERRORIGNORE YES
VERSION BUILD=8961227 RECORDER=FX
TAB T=1
URL GOTO=http://www.weibo.com/#{your nick name}/profile
WAIT SECONDS=3
TAG POS=2 TYPE=I ATTR=TXT:c
TAG POS=1 TYPE=A ATTR=TXT:删除
TAG POS=1 TYPE=SPAN ATTR=TXT:确定
# 上面的版本造成过多刷新载入页面,速度太慢
require 'faraday'
require 'json'
connection = Faraday.new('http://www3.nhk.or.jp') do |builder|
builder.request :url_encoded
builder.response :logger
builder.adapter Faraday.default_adapter
end
begin