Elixir 入门指南中文版
年代久远
https://iovxw.gitbooks.io/programming-elixir
把别人翻译的整理了一下
Github: https://github.com/iovxw/programming-elixir
英文: http://elixir-lang.org/getting-started/introduction.html
https://iovxw.gitbooks.io/programming-elixir
把别人翻译的整理了一下
Github: https://github.com/iovxw/programming-elixir
英文: http://elixir-lang.org/getting-started/introduction.html
块加密流加密之类的就不说了,只是单独说一下这个加密模式
算是和现在用的 VIM 的配色比较接近了
defrecord Person, first_name: nil, last_name: "Dudington" do
def name record do # huh ?
"#{record.first_name} #{record.last_name}"
end
end
defrecord User, name: "José", age: 25
guy = Person.new first_name: "Guy"
guy.name
defmodule ListServer do
@moduledoc """
This module provides an easy to use ListServer, useful for keeping
lists of things.
"""
use GenServer.Behaviour
alias Foo.Bar
### Public API
@doc """
Starts and links a new ListServer, returning {:ok, pid}
## Example
iex> {:ok, pid} = ListServer.start_link
"""
def start_link do
:gen_server.start_link({:local, :list}, __MODULE__, [], [])
end
### GenServer API
def init(list) do
{:ok, list}
end
# Clear the list
def handle_cast :clear, list do
{:noreply, []}
end
end
{:ok, pid} = ListServer.start_link
pid <- {:foo, "bar"}
greeter = fn(x) -> IO.puts "hey #{x}" end
greeter.("Bob")
意料之外,情理之中
就把右侧一直懒得换的百度换成了 Google
夏天过去了,人却依旧懒
上图为煎蛋无聊图爬虫里的comment储存结构体,在编码为json时发现需要定义几个东西,如下:
参见:https://appdb.winehq.org/objectManager.php?sClass=version&iId=30180&iTestingId=88496
具体流程就是
先安装最新版1.7 Wine和winetricks,步骤什么的就不用我说了,应该都会
如果你直接装的64位wine,需要先设置成32位wine环境
export WINEARCH=win32
(可以放在~/.bashrc或者~/.zshrc里自动设置,具体什么文件还得看你用的什么shell)
然后winetricks steam
安装Steam
winetricks会把steam装在一个新的WINEPREFIX目录里
为了省事,以后的配置就在这个目录里进行,所以设置一下全局的WINEPREFIX
export WINEPREFIX="~/.local/share/wineprefixes/steam"
设置完成以后安装运行库
winetricks vb6run dotnet40
然后还依赖几个dll,所以从网上下载32位的mscoree.dll
,oleaut32.dll
和x3daudio1_7.dll
,覆盖到
~/.local/share/wineprefixes/steam/drive_c/windows/system32
目录里
启动Steam,会自动更新,有机率更新失败。我是直接放在虚拟机里更新成功的
在Steam设置中关闭游戏中Steam界面,不然会挂掉
然后常规流程安装或者下载游戏就行
运行前记得删除游戏安装目录里的Content/checksum.xml
,不然会启动失败
游戏配置在游戏里因为balabala什么的没法改,自己想办法吧
附上成功截图一张:
最后是个悲报……我电脑配置太渣玩起来太卡所以白折腾了
Crystal 是一个语法像 Ruby,性能堪比C的语言
详细就不介绍了,直接去官网看吧
其实直接参考里面的Vagrantfile就行(Dockerfile太久没更新就无视吧)
curl -s http://dist.crystal-lang.org/apt/setup.sh | bash
apt-get install -y crystal git libgmp3-dev zlib1g-dev libedit-dev libxml2-dev libssl-dev libyaml-dev libreadline-dev
curl -s http://crystal-lang.s3.amazonaws.com/llvm/llvm-3.5.0-1-linux-x86_64.tar.gz | tar xz -C /opt
echo 'export LIBRARY_PATH="/opt/crystal/embedded/lib"' > /etc/profile.d/crystal.sh
echo 'export PATH="$PATH:/opt/llvm-3.5.0-1/bin"' >> /etc/profile.d/crystal.sh
git clone https://github.com/manastech/crystal.git
make
顺便照着写了个Dockerfile
FROM ubuntu:14.04
RUN apt-key adv --keyserver keys.gnupg.net --recv-keys 09617FD37CC06B54 && \
echo "deb http://dist.crystal-lang.org/apt crystal main" > /etc/apt/sources.list.d/crystal.list && \
apt-get update && \
apt-get install -y build-essential crystal curl git libgmp3-dev zlib1g-dev libedit-dev libxml2-dev libssl-dev libyaml-dev libreadline-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
curl -s http://crystal-lang.s3.amazonaws.com/llvm/llvm-3.5.0-1-linux-x86_64.tar.gz | tar xz -C /opt
ENV LIBRARY_PATH=/opt/crystal/embedded/lib
ENV PATH=$PATH:/opt/llvm-3.5.0-1/bin
RUN git clone https://github.com/manastech/crystal.git /root/crystal
WORKDIR /root/crystal
也可以直接docker pull iovxw/crystal
我build好的
默认只是配置好环境,进去之后make什么都随便
顺带一提里面的轻量级线程还有channel好顺手啊,还带select
def generator(n : T)
channel = Channel(T).new
spawn do
loop do
sleep n
channel.send n
end
end
channel
end
ch1 = generator(1)
ch2 = generator(1.5)
ch3 = generator(5)
loop do
case ch = Channel.select(ch1, ch2, ch3)
when ch3
break
else
puts ch.receive
end
end
golang里面函数的多返回值就相当于一个展开过的切片
像这个样子:
[]interface{}{返回值1, 返回值2}...
于是我们把它反过来就行了
package main
import (
"fmt"
"strconv"
)
func toSlice(v ...interface{}) []interface{} { return v }
func main() {
fmt.Println(toSlice(strconv.Atoi("1")))
}
大致就是性能优化、GC优化、新增架构支持以及包可以导出给其他地方使用,还有给map加了个语法糖
http://blog.rust-lang.org/2015/05/15/Rust-1.0.html