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 / rancheros_install.md
Last active May 1, 2019 06:54
rancheros installation & rancher usage

##install rancheros to disk download the rancheros from https://releases.rancher.com/os/latest/rancheros.iso start the rancheros from the downloaded rancheros.iso. After the rancheros is started, login with user/password rancher/rancher,

if your machine is behind the proxy, you can download the rancher/os:v.x.y.z from a machine which docker is installed:

$ docker pull rancher/os:v.x.y.z
$ docker save -o rancheros_v.x.y.z.tar rancher/os:v.x.y.z
@ochinchina
ochinchina / PCD8544.c
Created March 17, 2016 03:25
PCD8544 in raspberry pi
/*
=================================================================================
Name : PCD8544.c
Version : 0.1
Copyright (C) 2010 Limor Fried, Adafruit Industries
CORTEX-M3 version by Le Dang Dung, 2011 LeeDangDung@gmail.com (tested on LPC1769)
Raspberry Pi version by Andre Wussow, 2012, desk@binerry.de
Description :
A simple PCD8544 LCD (Nokia3310/5110) driver. Target board is Raspberry Pi.
This driver uses 5 GPIOs on target board with a bit-bang SPI implementation
@ochinchina
ochinchina / remove_snapshot_in_release.md
Created March 3, 2016 06:43
remove snapshot in the apache archiva repositories/internal

if you publish a snapshot release to apache/archiva and start to browse the repository, you will get "managed repo is configured for release only" error.

To fix this, you should:

  1. login to the archiva installed machine
  2. goto the repository repositories/internal to find the component whose snapshot is pushed
  3. delete the snapshot version directory ( like "1.0-SNAPSHOT" )
  4. remove the snapshot version from maven-metadata.xml file
  5. re-generate the md5 and put it to the maven-metadata.xml.md5 like below:
@ochinchina
ochinchina / ClassScanner.java
Created December 18, 2015 06:22
scan all the classes under a specific package recursively
import java.io.File;
import java.net.URL;
public class ClassScanner {
@FunctionalInterface
public static interface ClassProcessor {
void processClass( Class clazz ) ;
}
@ochinchina
ochinchina / AppConfig.java
Last active December 14, 2015 09:58
spring: autowire bean to non-managed object
package org.spring.test;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableLoadTimeWeaving;
import org.springframework.context.annotation.EnableLoadTimeWeaving.AspectJWeaving;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.aspectj.EnableSpringConfigured;
@Configuration
@ochinchina
ochinchina / ByteBufInputStream.java
Created December 14, 2015 02:21
netty ByteBuf to InputStream adapter
import java.io.IOException;
import java.io.InputStream;
import io.netty.buffer.ByteBuf;
public class ByteBufInputStream extends InputStream {
private ByteBuf buf = null;
private int len = 0;
@ochinchina
ochinchina / docker_1.9_on_ubuntu_14.04.md
Created September 6, 2015 08:56
install the docker 1.9-dev to ubuntu 14.04

###add patch

get the script from https://get.docker.com/ubuntu/, the script is:

# Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
	apt-get update
	apt-get install -y apt-transport-https
fi
@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

@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 / 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