Skip to content

Instantly share code, notes, and snippets.

View ochinchina's full-sized avatar

Steven Ou ochinchina

  • NOKIA Chengdu, China
View GitHub Profile
@ochinchina
ochinchina / pipe_demo.go
Created May 28, 2015 08:13
golang: connect two commands with pipe
package main
import (
"bytes"
"io"
"os"
"os/exec"
)
func main() {
@ochinchina
ochinchina / clear_ubuntu_unused_kernel_image.md
Created May 29, 2015 01:33
clear unused linux kernel image from /boot

###clear unused linux kernel image from /boot

sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")
@ochinchina
ochinchina / docker_container_inter_communication.md
Last active August 29, 2015 14:22
cross node docker container communication

This Gist demos how to make the inter communication between docker containers ( cross node)

###inter communication through Birdge

suppose there are two nodes n1: 192.168.1.1 and n2: 192.168.1.2, in the node n1 start container c1 and in the node n2 start container c2.


  --------------------         ------------------------
 |                    |        |                        |
 |      --------      |        |      ---------         |
@ochinchina
ochinchina / use_wnameless_oracle-xe-11g.md
Last active April 3, 2025 17:43
how to use wnameless/oracle-xe-11g docker image

##pull wnameless/oracle-xe-11g

$ sudo docker pull wnameless/oracle-xe-11g

##start the wnameless/oracle-xe-11g

$ sudo docker run -d -p 49160:22 -p 49161:1521 wnameless/oracle-xe-11g
@ochinchina
ochinchina / top_jstack_thread_cpu.md
Created July 24, 2015 07:51
use linux top command and the jdk utility jstack to find which java thread consumes most CPU

use top command to find which java thread consume high CPU

Using the following command to find what java threads consume high CPU

$ top -n1 -p <pid> -H
Tasks:  47 total,   0 running,  47 sleeping,   0 stopped,   0 zombie
Cpu(s): 22.1%us,  2.2%sy,  0.0%ni, 74.8%id,  0.0%wa,  0.0%hi,  0.9%si,  0.0%st
@ochinchina
ochinchina / centos7_in_virtualbox_behind_proxy.md
Last active August 29, 2015 14:26
install the centos7 in virtualbox behind the firewall

install the minimal centos-7 in the virtualbox

add host-only network adapter

set the ip address for enp0s3

# ip addr add 10.0.2.15/24 enp0s3
@ochinchina
ochinchina / NettyConnection.java
Last active January 11, 2024 01:32
netty client reconnect if the connection is lost or the server is not started
package com.nokia.nls.nmif;
import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
@ochinchina
ochinchina / virtualbox_vboxnet.md
Created August 7, 2015 07:47
virtualbox vboxnet management in the linux system

create hostonly network

$ vboxmanage hostonlyif create
%0...%10...%20...%30...%40...%50...%60...%70...%80...%90...%100
Interface 'vboxnet3' was successfully created

###assign ip address to the newly create network

@ochinchina
ochinchina / arch_linux_usage.md
Last active August 29, 2015 14:27
some experience on archlinux

###install openssh

$ sudo pacman -Sy openssh
$ sudo systemctl enable sshd
$ sudo systemctl start sshd

###enable DHCP

@ochinchina
ochinchina / try_docker_networking_cluster.md
Last active September 1, 2015 01:40
try the docker experimental multihost overlay network + swarm

assumption:

node 1: ip address is 192.168.56.101

node 2: ip address is 192.168.56.102

get the experimental docker binary

get the x86_64 bit version