Skip to content

Instantly share code, notes, and snippets.

View yjhjstz's full-sized avatar
🏠
Working from home

Jianghua.yjh yjhjstz

🏠
Working from home
View GitHub Profile
@yjhjstz
yjhjstz / stacktrace.cc
Created January 28, 2016 09:22 — forked from bnoordhuis/stacktrace.cc
Decode C/C++ and V8 JS stack frames.
#include "v8.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <cxxabi.h>
#include <dlfcn.h>
using namespace v8;
@yjhjstz
yjhjstz / proxy.txt
Created February 17, 2016 02:38
git/npm
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
Using worker: bluebox-linux-8.worker.travis-ci.org:travis-linux-12
git.1
$ git clone --depth=50 git://github.com/pconstr/irf.git pconstr/irf
Cloning into 'pconstr/irf'...
remote: Counting objects: 100, done.
remote: Compressing objects: 100% (68/68), done.
remote: Total 100 (delta 50), reused 78 (delta 28)
Receiving objects: 100% (100/100), 80.75 KiB, done.
Resolving deltas: 100% (50/50), done.
$ cd pconstr/irf
@yjhjstz
yjhjstz / epoll.c
Last active October 19, 2016 03:48
poll test/ ET mode
#include <sys/socket.h>
#include <sys/epoll.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <boost/thread.hpp>
#include <boost/asio.hpp>
#include <memory>
#include <atomic>
#include <chrono>
#include <sys/resource.h>
using namespace boost::asio;
using namespace boost::asio::ip;
using namespace std::chrono;
using boost::system::error_code;
@yjhjstz
yjhjstz / async_asio_server.cpp
Created January 6, 2017 09:34
async_asio_server
#include <boost/thread.hpp>
#include <boost/asio.hpp>
#include <memory>
#include <atomic>
#include <sys/resource.h>
using namespace boost::asio;
using namespace boost::asio::ip;
using boost::system::error_code;
using std::shared_ptr;
@yjhjstz
yjhjstz / pstack-osx.sh
Created June 14, 2017 06:44 — forked from theirix/pstack-osx.sh
pstack for osx
#!/bin/sh
#
# Script prints gdb stack of the process with a specified pid
if [ -z $1 ]; then
echo "Usage: $0 pid"
exit 1
fi
PID=$1
@yjhjstz
yjhjstz / README.md
Created June 16, 2017 11:39 — forked from rantav/README.md
Find slow queries in mongo DB

A few show tricks to find slow queries in mongodb

Enable profiling

First, you have to enable profiling

> db.setProfilingLevel(1)

Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target...

@yjhjstz
yjhjstz / leak.stp
Created November 6, 2017 08:02
memory leak systemTap script
global ptr2bt
global ptr2size
global bt_stats
global quit
probe begin {
warn("Start tracing. Wait for 10 sec to complete.\n")
}
probe process("/lib/x86_64-linux-gnu/libc.so.6").function("malloc").return {

TensorFlow Severing

本文讲解如何使用TensorFlow Severing落地一个训好的模型。

安装

Bazel (可选,编译源代码才用)

# 从https://github.com/bazelbuild/bazel/releases下载bazel安装包
cd ~/Downloads
chmod +x bazel-0.4.5-installer-linux-x86_64.sh
./bazel-0.4.5-installer-linux-x86_64.sh --user