Skip to content

Instantly share code, notes, and snippets.

View lidaobing's full-sized avatar
🦍
Mammal - verified by Github

LI Daobing lidaobing

🦍
Mammal - verified by Github
View GitHub Profile
class Helloworld
def call(env)
[200, {'Content-Type' => 'text/plain'}, ['hello world!']]
end
end
run Helloworld.new
$ gedit
Traceback (most recent call last):
File "/usr/lib/gedit-2/plugins/advanced-bookmarks/plugin.py", line 62, in activate
self._instances[window] = window_helper.window_helper(self, window, self._bookmarks, self._config)
AttributeError: 'AdvancedBookmarksPlugin' object has no attribute '_bookmarks'
Traceback (most recent call last):
File "/usr/lib/gedit-2/plugins/advanced-bookmarks/plugin.py", line 69, in update_ui
self._instances[window].update_ui()
KeyError: <gedit.Window object at 0x2305910 (GeditWindow at 0x1bac0c0)>
Traceback (most recent call last):
irb(main):001:0> a = Object.new
=> #<Object:0x7ff7a6ff6388>
irb(main):002:0> a.object_id #获取对象ID
=> 70350817702340
irb(main):003:0> a.class #获取对象类型
=> Object
irb(main):004:0> Integer.superclass #获取父类
=> Numeric
irb(main):006:0> Numeric.superclass #...
=> Object
;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;
; All relative paths in this configuration file are relative to PHP's install
; prefix.
; Include one or more files. If glob(3) exists, it is used to include a bunch of
; files from a glob(3) pattern. This directive can be used everywhere in the
; file.
@lidaobing
lidaobing / .emacs
Last active August 26, 2020 07:13
.emacs
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(TeX-PDF-mode t)
'(auto-compression-mode t nil (jka-compr))
'(browse-url-browser-function 'browse-url-firefox)
'(c-offsets-alist
'((arglist-intro . +)
@lidaobing
lidaobing / gist:833554
Created February 18, 2011 11:18
yaml support recursive reference
class A; attr_accessor :b; end
class B; attr_accessor :a; end
a = A.new
b = B.new
a.b = b
b.a = a
puts a.to_yaml
# --- &id001 !ruby/object:A
# b: !ruby/object:B
# a: *id001
@lidaobing
lidaobing / rar2zip.sh
Created April 6, 2011 14:02
convert rar to zip
#!/bin/sh
set -e
if [ $# != 1 ]; then
echo "Usage: `basename $0` FOO.rar"
exit 2
fi
package com.lidaobing.niotest.bin;
import java.net.InetSocketAddress;
import java.util.concurrent.Executors;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.Channels;
package com.lidaobing.niotest.bin;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ExceptionEvent;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
public class EchoHandler extends SimpleChannelUpstreamHandler {
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
PATH=~/bin:"${PATH}"
fi
if [ -d ~/.local/bin ]; then