Skip to content

Instantly share code, notes, and snippets.

Avatar

William Herry williamherry

View GitHub Profile
@williamherry
williamherry / bearychat-webhook.coffee
Last active Apr 2, 2016
集成到倍洽(bearychat)的hook代码
View bearychat-webhook.coffee
{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"
View hubot-explore.md

安装

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

➜  node --version
v0.12.4
➜  npm --version
View username-concept.rb
# 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
View tinyssh.erl
-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]).
View mm_ssh.erl
%%% -------------------------------------------------------------------
%%% Author : anton
%%% Description :
%%%
%%% Created : 21 Dec 2008
%%% -------------------------------------------------------------------
-module(mm_ssh).
-behaviour(gen_fsm).
%% --------------------------------------------------------------------
View vagrant
/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 Oct 8, 2012
interface don't need to up when use bridge
View bridge.log
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.
View git-clone-fail.log
Initialized empty Git repository in /root/notes/.git/
(gnome-ssh-askpass:4841): Gtk-WARNING **: cannot open display:
View install-ruby-debug-fail.log
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 ***
View guestmount.log
===== Test starts here =====
LIBGUESTFS_DEBUG=1
TMPDIR=(not set)
libguestfs: new guestfs handle 0xaee700
library version: 1.16.19rhel=6,release=1.el6
guestfs_get_append: (null)
guestfs_get_attach_method: appliance
guestfs_get_autosync: 1
guestfs_get_direct: 0
guestfs_get_memsize: 500
You can’t perform that action at this time.