This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fileutils' | |
require 'date' | |
require 'yaml' | |
require 'rexml/document' | |
require 'ya2yaml' | |
include REXML | |
doc = Document.new(File.new(ARGV[0])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fileutils' | |
require 'date' | |
require 'yaml' | |
require 'rexml/document' | |
require 'ya2yaml' | |
include REXML | |
doc = Document.new(File.new(ARGV[0])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 通过 HTTP_RANGE | |
// VERSION 1 断点下载 | |
range = 0; | |
dheader('Accept-Ranges: bytes'); | |
if(!empty(_SERVER['HTTP_RANGE'])) { | |
list(range) = explode('-',(str_replace('bytes=', '', _SERVER['HTTP_RANGE']))); | |
rangesize = (filesize - range) > 0 ? (filesize - range) : 0; | |
dheader('Content-Length: '.rangesize); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CronExp { | |
public function match($expression, $time = NULL){ | |
if(empty($time)){ | |
$time = time() - time() % 60; // rounded to current minute | |
}elseif(is_string($time)){ | |
$time = strtotime($time); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2012 Jiang Bian (borderj@gmail.com). All rights reserved. | |
// Use of this source code is governed by a BSD-style | |
// license that can be found in the LICENSE file. | |
// Email: borderj@gmail.com | |
// Blog: http://wifihack.net/ | |
// Sina WeiBo oauth2 Login, Base on goauth2 lib | |
package main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Twitter::Client | |
def initialize(token, secret) | |
@client = ::Twitter::REST::Client.new do |config| | |
config.consumer_key = Rails.application.secrets.twitter_api_key | |
config.consumer_secret = Rails.application.secrets.twitter_api_secret | |
config.access_token = token | |
config.access_token_secret = secret | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Takes out twitter handle of all your followers | |
var x = document.getElementsByClassName("u-linkComplex-target"); | |
var i = 0; | |
var followers_handle = ["iam_kartikmaji"] | |
var following_counter = 1; | |
var time = setInterval( | |
function(){ | |
i++; | |
followers_handle[followers_handle.length] = x[i].innerText; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
) | |
func Log(handler http.Handler) http.Handler { | |
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//获取本地IP地址 | |
var os = require('os'); | |
var IPv4,hostName; | |
hostName=os.hostname(); | |
for(var i=0;i<os.networkInterfaces().eth0.length;i++){ | |
if(os.networkInterfaces().eth0[i].family=='IPv4'){ | |
IPv4=os.networkInterfaces().eth0[i].address; | |
} | |
} | |
console.log('----------local IP: '+IPv4); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is derived version of https://github.com/mojombo/jekyll/blob/master/lib/jekyll/migrators/wordpress.rb | |
$KCODE='UTF8' | |
require 'rubygems' | |
require 'sequel' | |
require 'fileutils' | |
require 'yaml' | |
require 'ya2yaml' | |
module Jekyll |
OlderNewer