start new:
tmux
start new with session name:
tmux new -s myname
#!/usr/bin/perl | |
undef $/; | |
$text = <>; | |
$text =~ s/\/\/[^\n\r]*(\n\r)?//g; | |
$text =~ s/\/\*+([^*]|\*(?!\/))*\*+\///g; | |
$text =~ s/\n+/\n/g; |
require 'date' | |
author = "Saito" | |
email = "[email protected]" | |
date = Date.new(2012, 7, 30) | |
s = %w{ | |
. . . . . . . | |
. . o o o . . | |
. o . . . . . |
// Copyright 2011 Google Inc. All rights reserved. | |
// Use of this source code is governed by the Apache 2.0 | |
// license that can be found in the LICENSE file. | |
package guestbook | |
import ( | |
"http" | |
"io" | |
"os" |
// Exercise: Loops and Functions - http://tour.golang.org/#44 | |
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
func Sqrt(x float64) float64 { |
package main | |
import "fmt" | |
// fibonacci is a function that returns | |
// a function that returns an int. | |
func fibonacci() func() int { | |
x, y := 0, 1 | |
return func() int { | |
x, y = y, x + y |
#修改主机名 | |
scutil --set HostName $newhostname | |
#计算机名 | |
scutil --set ComputerName $newcomputername |
# coding: utf-8 | |
require 'sinatra' | |
set server: 'thin', connections: [] | |
get '/' do | |
halt erb(:login) unless params[:user] | |
erb :chat, locals: { user: params[:user].gsub(/\W/, '') } | |
end | |
get '/stream', provides: 'text/event-stream' do |
#!/bin/sh | |
# on ubuntu: need some utils & dev libs | |
sudo apt-get install apache2-utils openssl libssl-dev libpcre3-dev | |
# compile nginx | |
cd /tmp | |
curl http://nginx.org/download/nginx-0.7.64.tar.gz | tar xz | |
cd nginx* | |
./configure --with-http_ssl_module --with-http_dav_module \ |
# /etc/init.d/nginx | |
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 |