Skip to content

Instantly share code, notes, and snippets.

View longtian's full-sized avatar
🎯
Focusing

龙天 longtian

🎯
Focusing
View GitHub Profile
@longtian
longtian / APMUtil.php
Last active August 29, 2015 14:09
Start a new transaction in daemon script
<?php
class APMUtil {
/**
* set the transaction name to display in newrelic dashboard
* @param string $name
*/
public static function setTransactioName($name) {
if (self::isNewrelicEnabled()) {
@longtian
longtian / index.html
Created November 24, 2014 15:54
knockout demo
<div id="configure">
<p>
Name:<input data-bind="value:name"/>
</p>
<p>
CPU:<select name="cpu" data-bind="options:availableCpuOption,value:cpu"></select>
</p>
<p>
Memory:<select data-bind="options:availableMemoryOption,value:memory"></select>
</p>
@longtian
longtian / NiceSSH_class.php
Created December 10, 2014 06:42
SSH Connection
class NiceSSH {
// SSH Host
private $ssh_host = 'myserver.example.com';
// SSH Port
private $ssh_port = 22;
// SSH Server Fingerprint
private $ssh_server_fp = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
// SSH Username
private $ssh_auth_user = 'username';
// SSH Public Key File
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
@longtian
longtian / README.md
Created September 24, 2016 12:50
配置全局的 gitignore_global 命令行

Linux

Windows

git config --global core.excludesfile "${USERPROFILE}/.gitignore_global"
sudo vim /proc/sys/kernel/core_pattern
|/usr/share/apport/apport %p %s %c %P
@longtian
longtian / README.md
Last active March 2, 2017 11:37
How to migrate redis container between hosts

问题

A、B 是两台 Docker 主机,假设 A 机器上有一个运行着的 Redis 容器,想要把这个容器移动到 B 机器上,问最简单的方式是什么?

A 机器上正在运行 rapp 容器

docker run --name=app -d redis redis-server --appendonly yes

docker exec app redis-cli set message hello_world

@longtian
longtian / a.txt
Last active May 9, 2017 11:58
difference between setTimeout and nextTick
strace -c node -e "for(var i=0;i<100;i++){setTimeout(()=>{},i*10)}"
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
0.00 0.000000 0 8 read
0.00 0.000000 0 1 write
0.00 0.000000 0 47 38 open
0.00 0.000000 0 9 close
0.00 0.000000 0 4 3 stat
0.00 0.000000 0 12 fstat
@longtian
longtian / README.md
Last active June 15, 2017 06:34
A collection of public grafana dashboards