Skip to content

Instantly share code, notes, and snippets.

@developerworks
developerworks / landscape_errors
Created July 3, 2015 05:04
Deploy landscape errors output
[DEBUG • 07-03 11:18:51] • cloudinstall.ui.dialog • (dialog.py, _build_widget, 93)]
Num items: 2, items: <ListBox selectable box widget>
[DEBUG • 07-03 11:18:54] • cloudinstall.ui.dialog • (dialog.py, submit, 111)]
Callback on : OrderedDict([('password', <EditInput selectable flow widget>), ('confirm_password', <EditInput selectable flow widget>)])
[DEBUG • 07-03 11:18:56] • cloudinstall.ui • (__init__.py, submit, 214)]
Callback on : OrderedDict([('Landscape OpenStack Autopilot', (<RadioButton selectable flow widget 'Landscape OpenStack Autopilot' state=True>, 'Benefit from best practices in cloud building, and get up and running within minutes, all from an intuitive web UI.')), ('Multi', (<RadioButton selectable flow widget 'Multi' state=False>, 'OpenStack installation utilizing MAAS.')), ('Single', (<RadioButton selectable flow widget 'Single' state=False>, 'Fully containerized OpenStack installation on a single machine.'))])
[INFO • 07-03 11:18:56] • cloudinstall.install • (install.py, do_install
```
EXCEPTION: Error during instantiation of Token(Promise<ComponentRef>)!.
angular2.dev.js:25219 EXCEPTION: Error during instantiation of Token(Promise<ComponentRef>)!.execute.$__super.logError @ angular2.dev.js:25219execute.$__super.logGroup @ angular2.dev.js:25230execute.ExceptionHandler.call @ angular2.dev.js:20915(anonymous function) @ angular2.dev.js:27344run @ angular2.dev.js:136execute.$__3._createInnerZone.zone.fork.fork.$run @ angular2.dev.js:16593execute.$__3.run @ angular2.dev.js:16556commonBootstrap @ angular2.dev.js:27321(anonymous function) @ show-properties.ts:53(anonymous function) @ show-properties.ts:53__exec @ system.src.js:1384entry.execute @ system.src.js:3502linkDynamicModule @ system.src.js:2905link @ system.src.js:2748Promise.all.then.normalizedDeps.execute @ system.src.js:3076doDynamicExecute @ system.src.js:715link @ system.src.js:916doLink @ system.src.js:569updateLinkSetOnLoad @ system.src.js:617(anonymous function) @ system.src.js:430run @ angular2.dev.js:136zoneBoundFn @ angular
=INFO REPORT==== 1-Nov-2015::00:08:29 ===
application: logger
exited: stopped
type: temporary
** (Mix) Could not start application elixir_distribution_application_exmaple: ElixirDistributionApplicationExmaple.start({:takeover, :"b@192.168.8.104"}, []) returned an error: shutdown: failed to start child: ElixirDistributionApplicationExmaple.Worker
** (EXIT) already started: #PID<2971.167.0>
@developerworks
developerworks / api_bridge.ex
Created November 3, 2015 17:33 — forked from upbit/api_bridge.ex
Module for rpc call remote api@node functions
defmodule ApiBridge do
@moduledoc """
Module for rpc call remote api@node functions.
"""
@defualt_rpc_timeout 3000
@doc """
rpc macro for api call
"""
defmacro rpc(exp, timeout \\ @defualt_rpc_timeout) do
@developerworks
developerworks / gist:721aac2670caa64ea4c0
Last active November 4, 2015 07:22
Compute the avg cpu load
defmodule Test do
require Logger
def get_normalized_load do
:application.ensure_all_started(:os_mon)
loads = [:cpu_sup.avg1, :cpu_sup.avg5, :cpu_sup.avg15] |> Enum.map(fn x ->
x / :erlang.system_info(:logical_processors) / 256
end)
Logger.debug "Loads: #{inspect loads}"
loads
end
@developerworks
developerworks / last_names.exs
Created March 1, 2016 09:25
Generate last name
require Logger
defmodule LastName do
def main do
last_names = ~w(
赵 钱 孙 李 周 吴 郑 王 冯 陈 褚 卫 蒋 沈 韩 杨 朱 秦 尤 许
何 吕 施 张 孔 曹 严 华 金 魏 陶 姜 戚 谢 邹 喻 柏 水 窦 章
云 苏 潘 葛 奚 范 彭 郎 鲁 韦 昌 马 苗 凤 花 方 俞 任 袁 柳
酆 鲍 史 唐 费 廉 岑 薛 雷 贺 倪 汤 滕 殷 罗 毕 郝 邬 安 常
乐 于 时 傅 皮 卞 齐 康 伍 余 元 卜 顾 孟 平 黄 和 穆 萧 尹
姚 邵 湛 汪 祁 毛 禹 狄 米 贝 明 臧 计 伏 成 戴 谈 宋 茅 庞
@developerworks
developerworks / migration.py
Created April 27, 2016 08:42 — forked from lucperkins/migration.py
Migrate SQL table to Riak
import psycopg2
from riak import RiakClient, RiakObject
from riak.datatypes import Set
import datetime
# Riak connection and set
client = RiakClient(pb_port=8087)
SETS_BUCKET = client.bucket_type('sets').bucket('key_sets')
# Get columns for table
%% Author: Alex Radetsky <rad@pearlpbx.com>
%% Module: Simple SMPP Server on Erlang, gen_fsm, ranch, smpp34pdu.
%% It always authorize bind_transceiver and receives submit_sm
-module(smpp_protocol).
-behaviour(gen_fsm).
-behaviour(ranch_protocol).
-include_lib("smpp34pdu/include/smpp34pdu.hrl").
> build with kerl configurre option is:
> KERL_CONFIGURE_OPTIONS="--disable-native-libs --enable-vm-probes --with-dynamic-trace=systemtap --with-ssl=/usr/local --enable-hipe --enable-kernel-poll --without-odbc --enable-threads --enable-sctp --enable-smp-support --enable-sharez-zlib --enable-dynamic-ssl-lib"
> When i list the probes about erlang, the result is ok
```
ubuntu@ubuntu:~/systemtap$ stap -L 'process("/home/ubuntu/.kerl/builds/18.3_dtrace/release_18.3/erts-7.3/bin/beam.smp").mark("*")' |grep message
process("/home/ubuntu/.kerl/builds/18.3_dtrace/release_18.3/erts-7.3/bin/beam.smp").mark("message__queued") $arg1:long $arg2:long $arg3:long $arg4:long $arg5:long $arg6:long
process("/home/ubuntu/.kerl/builds/18.3_dtrace/release_18.3/erts-7.3/bin/beam.smp").mark("message__receive") $arg1:long $arg2:long $arg3:long $arg4:long $arg5:long $arg6:long
ubuntu:~/systemtap/systemtap-3.0/testsuite/systemtap.examples/network$ sudo stap -vv /home/ycc/systemtap/systemtap-3.0/testsuite/systemtap.examples/network/nettop.stp
Systemtap translator/driver (version 3.0/0.166, non-git sources)
Copyright (C) 2005-2015 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
enabled features: NLS TR1_UNORDERED_MAP
Created temporary directory "/tmp/stapZuz725"
Session arch: x86_64 release: 4.2.0-36-generic
Kernel symbol table /lib/modules/4.2.0-36-generic/build/System.map unavailable, (No such file or directory)
Searched for library macro files: "/usr/local/share/systemtap/tapset/linux/*.stpm", found: 5, processed: 5
Searched for library macro files: "/usr/local/share/systemtap/tapset/*.stpm", found: 8, processed: 8