Skip to content

Instantly share code, notes, and snippets.

@hanxue
hanxue / ROS-Pub-Sub.py
Created March 15, 2014 07:28
ROS Python Publisher Subscriber
#!/usr/bin/env python
# license removed for brevity
import rospy
from std_msgs.msg import String
def talker():
pub = rospy.Publisher('chatter', String)
rospy.init_node('talker', anonymous=True)
r = rospy.Rate(10) # 10hz
while not rospy.is_shutdown():
{
"name": "myapp",
"description": "Boilerplate web app using node, express, backbone, marionette.",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node app.js"
},
"engines": {
"node": "0.11.x"
@hanxue
hanxue / node-protobuf-builderror.log
Created March 20, 2014 08:54
Node Protobuf 2.0.5 build error log
npm http GET https://registry.npmjs.org/ascli
> protobuf@0.8.7 install /usr/local/lib/node_modules/spotify-web/node_modules/protobuf
> node-gyp rebuild
protobuf/protobuf_full_do_not_use.target.mk:158: warning: overriding commands for target `Debug/protobuf_full_do_not_use.a'
protobuf/protobuf_full_do_not_use.host.mk:172: warning: ignoring old commands for target `Debug/protobuf_full_do_not_use.a'
protobuf/protobuf_lite.target.mk:152: warning: overriding commands for target `Debug/protobuf_lite.a'
protobuf/protobuf_lite.host.mk:166: warning: ignoring old commands for target `Debug/protobuf_lite.a'
CXX(host) Debug/obj.host/protobuf_full_do_not_use/protobuf/src/google/protobuf/stubs/strutil.o
@hanxue
hanxue / npm-libtool-error.log
Created March 20, 2014 09:12
Homebrew libtool cause error for npm
$ npm install -g lame
npm http GET https://registry.npmjs.org/lame
npm http 200 https://registry.npmjs.org/lame
npm http GET https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/readable-stream
npm http 304 https://registry.npmjs.org/readable-stream
npm http 304 https://registry.npmjs.org/debug
npm http 304 https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/string_decoder
@hanxue
hanxue / original-pythonpath.sh
Created April 3, 2014 11:59
pip pkg-config unavailable, build terminated
$ echo $PYTHONPATH
/usr/local/lib/python2.7/site-packages
@hanxue
hanxue / express-session-wrong.js
Created April 17, 2014 08:44
express.js TypeError: Cannot read property 'connect.sid' of undefined
app.use(express.static(path.join(__dirname, 'public')));
//required for passport
app.use(express.session({secret: 'secret'})); // session secret
app.use(passport.initialize());
app.use(passport.session()); // persistent login sessions
@hanxue
hanxue / AppDelegate.h
Last active August 29, 2015 14:00
Example Mac Notification code
#import <Cocoa/Cocoa.h>
@interface AppDelegate : NSObject <NSApplicationDelegate> {
@private
NSWindow *window;
}
@property (assign) IBOutlet NSWindow *window;
@end
@hanxue
hanxue / brew
Created April 25, 2014 09:20
Brew update error: Your local changes to the following files would be overwritten by merge
#!/bin/sh
BREW_FILE_DIRECTORY=$(dirname "$0")
BREW_FILE_DIRECTORY=$(cd "$BREW_FILE_DIRECTORY" && pwd -P)
BREW_FILENAME=$(basename "$0")
export HOMEBREW_BREW_FILE="$BREW_FILE_DIRECTORY/$BREW_FILENAME"
BREW_SYMLINK=$(readlink $0)
if [ -n "$BREW_SYMLINK" ]
then
@hanxue
hanxue / gitbucket-ant-2014-04-28
Created April 28, 2014 02:51
Gitbucket build error 28 Apr 2014
[exec] [info] Compiling 8 Scala sources to /private/tmp/gitbucket-CoUf/target/scala-2.10/test-classes...
[exec] [error]
[exec] [error] while compiling: /private/tmp/gitbucket-CoUf/src/test/scala/view/PaginationSpec.scala
[exec] [error] during phase: xsbt-api
[exec] [error] library version: version 2.10.3
[exec] [error] compiler version: version 2.10.3
[exec] [error] reconstructed args: -deprecation -classpath /private/tmp/gitbucket-CoUf/target/scala-2.10/test-classes:/private/tmp/gitbucket-CoUf/target/scala-2.10/classes:/Users/hanxue/.ivy2/cache/org.eclipse.jgit/org.eclipse.jgit.http.server/jars/org.eclipse.jgit.http.server-3.0.0.201306101825-r.jar:/Users/hanxue/.ivy2/cache/org.eclipse.jgit/org.eclipse.jgit/jars/org.eclipse.jgit-3.0.0.201306101825-r.jar:/Users/hanxue/.ivy2/cache/com.jcraft/jsch/jars/jsch-0.1.46.jar:/Users/hanxue/.ivy2/cache/com.googlecode.javaewah/JavaEWAH/jars/JavaEWAH-0.5.6.jar:/Users/hanxue/.ivy2/cache/org.scalatra/scalatra_2.10/j
@hanxue
hanxue / gitbucket-ant-2014-04-28
Created April 28, 2014 02:51
Gitbucket build error 28 Apr 2014
Buildfile: /private/tmp/gitbucket-CoUf/build.xml
clean:
war:
[exec] Listening for transport dt_socket at address: 5005
[exec] [info] Loading global plugins from /Users/hanxue/.sbt/0.13/plugins
[exec] [info] Updating {file:/Users/hanxue/.sbt/0.13/plugins/}global-plugins...
[exec] [info] Resolving com.github.mpeltonen#sbt-idea;1.5.2 ...
[exec] [info] Resolving commons-io#commons-io;2.0.1 ...