Skip to content

Instantly share code, notes, and snippets.

View williamherry's full-sized avatar

William Herry williamherry

View GitHub Profile
open(selectedDates, dateStr, instance) {
this.hotfix();
}
monthChange(selectedDates, dateStr, instance) {
this.hotfix();
}
yearChange(selectedDates, dateStr, instance) {
this.hotfix();
@williamherry
williamherry / bearychat-webhook.coffee
Last active April 2, 2016 14:46
集成到倍洽(bearychat)的hook代码
{TextMessage} = require '../node_modules/hubot/src/message'
module.exports = (robot) ->
robot.router.post '/hubot/bearychat/:room', (req, res) ->
data = if req.body.payload? then JSON.parse req.body.payload else req.body
robot._send ?= robot.adapter.send;
robot.adapter.send = (user,strings...) ->
res.send {text: strings.toString()} if user.user.name is "http"
robot.adapter.send = robot._send if user.user.name isnt "http"
@williamherry
williamherry / hubot-explore.md
Last active April 1, 2016 16:24
Hubot Explore

安装

Hubot需要Node和npm的比较新的版本,Mac os x安装非常简单,从nodejs.org下载安装就可以了

➜  node --version
v0.12.4
➜ npm --version
# app / controllers / application_controller.rb
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_filter :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
@williamherry
williamherry / tinyssh.erl
Created November 14, 2012 15:55
tinyssh erlang
-module(tinyssh).
-export([upload_download/1]).
-export([run_cmd/1]).
-export([download/3]).
-export([upload/3]).
-export([run_action/7]).
-export([run_action/6]).
-export([run/2]).
@williamherry
williamherry / mm_ssh.erl
Created November 13, 2012 04:25
mm_ssh
%%% -------------------------------------------------------------------
%%% Author : anton
%%% Description :
%%%
%%% Created : 21 Dec 2008
%%% -------------------------------------------------------------------
-module(mm_ssh).
-behaviour(gen_fsm).
%% --------------------------------------------------------------------
@williamherry
williamherry / vagrant
Created November 3, 2012 13:02
vagrant fail
/home/william/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- log4r (LoadError)
from /home/william/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/bin/vagrant:2:in `<main>'
@williamherry
williamherry / bridge.log
Created October 8, 2012 08:59
interface don't need to up when use bridge
williamherry | odd things, interface(em2) not up, but bridge on it work fine, can some one know the reason, what's interface 'UP' means? │ aaket504
tje2 | williamherry .. I don't believe the interface has to be "up" to *bridge* (read: NOT route), but to route packets (such as via MASQ/NAT, etc) the interface │ AAYUSH
| would have to be "UP". │ abbaZaba
melacon | Mohsen_Hassani:Oh ok. What operating system are you running on your PC? │ abchirk_
tje2 | williamherry .. Familiar at all w/ Cisco devices and the UP/UP vs. DOWN/DOWN states of those ifaces? │ aboudreault
Mohsen_Hassani | melacon, The same as my Laptop, Debian Sid.
@williamherry
williamherry / git-clone-fail.log
Created October 8, 2012 03:00
git clone fail
Initialized empty Git repository in /root/notes/.git/
(gnome-ssh-askpass:4841): Gtk-WARNING **: cannot open display:
@williamherry
williamherry / install-ruby-debug-fail.log
Created October 8, 2012 01:50
install ruby-debug fail
william@desktop:~$ gem install ruby-debug
WARNING: Error fetching data: SocketError: getaddrinfo: Name or service not known (http://rubygems.org/latest_specs.4.8.gz)
WARNING: Error fetching data: SocketError: getaddrinfo: Name or service not known (http://rubygems.org/specs.4.8.gz)
Building native extensions. This could take a while...
ERROR: Error installing ruby-debug:
ERROR: Failed to build gem native extension.
/home/william/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
Can't handle 1.9.x yet
*** extconf.rb failed ***