Skip to content

Instantly share code, notes, and snippets.

View wang-zhijun's full-sized avatar

WANG ZHIJUN wang-zhijun

  • Tokyo
View GitHub Profile
@wang-zhijun
wang-zhijun / client.go
Created December 8, 2016 01:29 — forked from spikebike/client.go
TLS server and client
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"log"
)
@wang-zhijun
wang-zhijun / wm.rst
Created June 3, 2016 03:03 — forked from voluntas/wm.rst
Webmachine コトハジメ

Webmachine コトハジメ

更新:2013-03-9
バージョン:0.2.1
作者:@voluntas
URL:http://voluntas.github.com/

Webmachine のバージョンは 1.9.3 で確認しています

@wang-zhijun
wang-zhijun / observer.md
Created March 9, 2016 05:33 — forked from pnc/observer.md
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
@wang-zhijun
wang-zhijun / install-vim74-centos
Last active February 10, 2016 04:14 — forked from juxtin/vim74centos
Compile Vim 7.4 on Centos and install my vimrc
#!/bin/bash
yum groupinstall 'Development tools' -y
yum install ncurses ncurses-devel wget git -y
cd /usr/local/src
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2
tar -xjf vim-7.4.tar.bz2
cd vim74
./configure --prefix=/usr --with-features=huge --enable-rubyinterp --enable-pythoninterp
make && make install
@wang-zhijun
wang-zhijun / ssh-router.exs
Created January 29, 2016 02:40 — forked from fredhsu/ssh-router.exs
SSH to router using Elixir
:ssh.start
{:ok, cref} = :ssh.connect('10.55.3.1', 22, [{:user, 'user'}, {:password, 'password'}])
{:ok, cid} = :ssh_connection.session_channel(cref, 5000)
:ssh_connection.exec(cref, cid, String.to_char_list("show ver | xml | no-more"), 3000)
#:ssh_connection.exec(cref, cid, String.to_char_list("show core"), 3000)
# need to do a receive on the cref(pid)
#flush() -- useful to find out what the result will look like
receive do
{:ssh_cm, _, {:data, _, _, d}} -> IO.puts d
end