Skip to content

Instantly share code, notes, and snippets.

View lanrion's full-sized avatar
🎯
Focusing

lanrion lanrion

🎯
Focusing
  • guǎng zhōu
View GitHub Profile
@lanrion
lanrion / gist:9866811
Created March 30, 2014 03:04
修改mysql root 用户密码
mysql>use mysql
mysql>update user set password=password("new_pass") where user="root";
mysql>flush privileges;
@lanrion
lanrion / gist:9866781
Created March 30, 2014 03:03
安装java ubuntu
@lanrion
lanrion / gist:9826458
Last active March 24, 2024 07:10
ubuntu上安装 五笔输入法

基于 IBus 框架

 1、安裝IBus框架:

  在终端中输入:

         sudo apt-get install ibus ibus-clutter ibus-gtk ibus-gtk3 ibus-qt4

  有些版本自带了此输入法框架,则不需要安装。
@lanrion
lanrion / gist:9801783
Last active August 29, 2015 13:57
ubuntu 快捷命令收集

Alt+F2 : 快速打开搜索栏。

Alt+Tab : 不同应用之间的切换,选中某一个,再Alt+~ 即可放大当前栏目。

下载了Sublime Text 之后,我们需要建立一个快捷命令

sudo mv Sublime\ Text\ 2 /opt/
sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime

参考 http://my.oschina.net/yexingkong/blog/140726

@lanrion
lanrion / gist:9479631
Last active December 5, 2023 08:20
浅析微信信息信息接收与信息回复

微信的信息接收与回复,两者是独立的。

信息接收

共同点在于:都有 ToUserName,FromUserName,CreateTime,MsgType, 这四个字段。

在信息接收方面,分为“普通消息”、“事件推送”,“语音识别结果(微信用户发送语音,微信服务器翻译成文本,只不过比语音消息多一个识别结果字段:Recognition)”。

  • 文本消息(通过“Content”关键字来获取文本内容,这点比较重要,也是使用比较多的场合)
  • 图片消息
class ApplicationController < ActionController::Base
...
#Problem:
#In rails 3.0.1+ it is no longer possible to do this anymore;
# rescue_from ActionController::RoutingError, :with => :render_not_found
#
#The ActionController::RoutingError thrown is not caught by rescue_from.
#The alternative is to to set a catch-all route to catch all unmatched routes and send them to a method which renders an error
#As in http://techoctave.com/c7/posts/36-rails-3-0-rescue-from-routing-error-solution
@lanrion
lanrion / gist:9320326
Last active August 29, 2015 13:56
fork 了某个开源项目,发了PR后,需要更新master的代码的做法
fork 了某个开源项目,发了PR后,需要更新master的代码的做法:
git remote add --track master upstream git://github.com/upstreamname/projectname.git
git fetch upstream
git merge upstream/master
注意:upstream 是定义名称。
@lanrion
lanrion / README.md
Created October 13, 2013 01:41 — forked from nikcub/README.md
@lanrion
lanrion / gist:6503952
Created September 10, 2013 01:41 — forked from ihower/gist:366372
class Dragon; end
# 使用 def 定義 class method
Dragon.instance_eval do
def foo
puts "bar"
end
end
Dragon.foo # bar
@lanrion
lanrion / test.clj
Created September 9, 2013 06:24 — forked from adambard/test.clj
; Comments start with semicolons.
; Clojure is written in "forms", which are just
; lists of things inside parentheses, separated by whitespace.
;
; The clojure reader assumes that the first thing is a
; function or macro to call, and the rest are arguments.
;
; Here's a function that sets the current namespace:
(ns test)