Skip to content

Instantly share code, notes, and snippets.

developerworks

Block or report user

Report or block developerworks

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@developerworks
developerworks / Writing Tools Writeup.markdown
Created Mar 12, 2018 — forked from mojavelinux/Writing Tools Writeup.markdown
How To Write A Technical Book (One Man's Modest Suggestions)
View Writing Tools Writeup.markdown
@developerworks
developerworks / index.html
Created Nov 7, 2017 — forked from martinsik/index.html
Simple WebSocket server based on libwebsockets. For full description read http://martinsikora.com/libwebsockets-simple-websocket-server
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
window.WebSocket = window.WebSocket || window.MozWebSocket;
var websocket = new WebSocket('ws://127.0.0.1:9000',
View ecto_closure_table.ex
defmodule CommentPath do
@moduledoc"""
Comment [closure table](http://www.slideshare.net/billkarwin/models-for-hierarchical-data).
"""
@primary_key false
schema "comment_paths" do
field :ancestor_id, Ecto.UUID
field :descendant_id, Ecto.UUID
field :depth, :integer
View closure_table_postgres_functions.sql
----------------------------------------------------------------------------------------
-- This function is used to update paths when inserted a new node
----------------------------------------------------------------------------------------
DROP FUNCTION IF EXISTS after_insert_node();
-- Step 1: Create a function used to update paths
CREATE OR REPLACE FUNCTION after_insert_node() RETURNS TRIGGER LANGUAGE PLPGSQL AS $$
BEGIN
View ranch_test.txt
➜ tmp git clone https://github.com/jekens/ranch_test.git
Cloning into 'ranch_test'...
remote: Counting objects: 21, done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 21 (delta 2), reused 21 (delta 2), pack-reused 0
Unpacking objects: 100% (21/21), done.
Checking connectivity... done.
➜ tmp cd ranch_test
View gist:284b0d3df43668d54596c4d37c7b4beb
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
View test.txt
> 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
View Example of simple SMPP session
%% 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").
@developerworks
developerworks / migration.py
Created Apr 27, 2016 — forked from lucperkins/migration.py
Migrate SQL table to Riak
View migration.py
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
View last_names.exs
require Logger
defmodule LastName do
def main do
last_names = ~w(
赵 钱 孙 李 周 吴 郑 王 冯 陈 褚 卫 蒋 沈 韩 杨 朱 秦 尤 许
何 吕 施 张 孔 曹 严 华 金 魏 陶 姜 戚 谢 邹 喻 柏 水 窦 章
云 苏 潘 葛 奚 范 彭 郎 鲁 韦 昌 马 苗 凤 花 方 俞 任 袁 柳
酆 鲍 史 唐 费 廉 岑 薛 雷 贺 倪 汤 滕 殷 罗 毕 郝 邬 安 常
乐 于 时 傅 皮 卞 齐 康 伍 余 元 卜 顾 孟 平 黄 和 穆 萧 尹
姚 邵 湛 汪 祁 毛 禹 狄 米 贝 明 臧 计 伏 成 戴 谈 宋 茅 庞
You can’t perform that action at this time.