Skip to content

Instantly share code, notes, and snippets.

View lujiacn's full-sized avatar

JL lujiacn

  • earth
  • earth
View GitHub Profile
From http://gorevel.cn/topic/14
1、使用刀符$访问全局变量,后面一种可以简化代码,省去了临时变量的定义
{{$user := .user}}
{{range .bookings}}
{{$user.Name}}
{{end}}
或(推荐)
package main
import (
"fmt"
// "github.com/nchern/go-R/R"
"io/ioutil"
"os"
"os/exec"
"strings"
"time"
/*Rserve go client */
package rservcli
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"net"
"strings"
= Few steps to enable Rserve daemon at startup of your Linux server =
# install [R] (tested with 2.9)
# install Rserve as user:
# create `Rserve.sh` startup script in `/home/user/R/x86_64-pc-linux-gnu-library/2.9/Rserve`:
{{{
#!/bin/bash
/usr/bin/R CMD Rserve --vanilla
}}}
# check that `Rserve.sh` is executable, try to launch it and verify Rserve is available (`ps -u user | grep Rserve` should return something, then kill Rserve)
@lujiacn
lujiacn / reflection.go
Created September 23, 2015 05:23 — forked from drewolson/reflection.go
Golang Reflection Example
package main
import (
"fmt"
"reflect"
)
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`
@lujiacn
lujiacn / docker.sh
Created October 13, 2015 06:46 — forked from nsisodiya/docker.sh
Upgrade to Docker 1.8 on ubuntu box
sudo su
echo deb https://apt.dockerproject.org/repo ubuntu-`cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d'=' -f2` main >> /etc/apt/sources.list.d/docker.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F76221572C52609D
apt-get update
apt-get purge lxc-docker*
apt-get purge docker.io*
apt-get install docker-engine
exit
@lujiacn
lujiacn / 0_reuse_code.js
Created October 16, 2015 06:41
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
git clone https://github.com/lujiacn/dot-vimrc.git .vim
git clone https://github.com/lujiacn/tmux.git tmux
ln -s .vim/vimrc ~/.vimrc
ln -s tmux/tmux.conf ~/.tmux.conf
#vim vundle
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
:BundleInstal
@lujiacn
lujiacn / install-tmux
Created October 18, 2015 05:29 — forked from rothgar/install-tmux
Install tmux 1.9 on rhel/centos 6
# Install tmux on Centos release 6.5
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xvzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=/usr/local