Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# -*- coding: UTF-8 -*-
def subString(str, s, e):
sPos = str.find(s)
if sPos == -1:
return None
sLen = len(s)
ePos = str.find(e, sPos + sLen)
print sPos, ePos
@holmeszyx
holmeszyx / checkssh
Created June 28, 2012 09:21
check ssh 7070
# pgrep -f "ssh -qTfnN"
NET=$(netstat -an | grep "7070")
NET_ST=$?
if [[ ${NET_ST} != 0 ]]; then
echo "ssh never opened"
else
echo "ssh opened"
@holmeszyx
holmeszyx / gist:3435736
Created August 23, 2012 11:25
Variable
package com.xxx.view.adpter;
import java.util.List;
/**
* 可变的的内容
* @author holmes
*
* @param <T>
*/
@holmeszyx
holmeszyx / gist:3435739
Created August 23, 2012 11:25
VariableAdatper
package com.xxx.view.adpter;
import java.util.List;
import android.content.Context;
import android.view.LayoutInflater;
import android.widget.BaseAdapter;
/**
* 可变内容的Adapter<br>
@holmeszyx
holmeszyx / gist:4123335
Created November 21, 2012 06:08
StructureTest
public class StructureTest {
public static void main(String[] args) {
ABCC abc = new ABCC();
System.out.println(abc.getCC());
}
private class ScreenDetailAdapter extends PagerAdapter{
ImageDownloaderEx mImageDownloaderEx;
String[] mUrls;
public ScreenDetailAdapter(String[] urls) {
// TODO Auto-generated constructor stub
DisplayMetrics dm = getResources().getDisplayMetrics();
SizeInfo sizeInfo = new SizeInfo(dm.widthPixels, dm.heightPixels);
sizeInfo.forDetail = true;
mImageDownloaderEx = new ImageDownloaderEx(thisInstance, sizeInfo);
public class SearchAppAdapter extends PagerAdapter{
public static final int DEFAULT_MAX_ITEM_SIZE = 4;
/**
* 全部数据集
*/
private List<AppInfo> data;
private Context mContext;
private int mMaxItemSize = DEFAULT_MAX_ITEM_SIZE;
/**
@holmeszyx
holmeszyx / gist:7133182
Last active December 26, 2015 09:59
改了下名,好看一点点
public function getLocation(_arg1:String):String{
var startvar:*;
var blockCont:* = Number(_arg1.charAt(0));
var realString:* = _arg1.substring(1);
var blockLength:* = Math.floor((realString.length / blockCont));
var remainLength:* = (realString.length % blockCont);
var pool:* = new Array();
var currentIndex:* = 0;
while (currentIndex < remainLength) {
if (pool[currentIndex] == undefined){
@holmeszyx
holmeszyx / gist:11077012
Created April 19, 2014 07:36
FixImageView 自动调整等比高宽
package com.example.imagetext.view;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.ImageView;
public class FixImageView extends ImageView{
private int mFixWidth = -1;
@holmeszyx
holmeszyx / gist:11260577
Created April 24, 2014 16:23
自动重试的Runnable, 用于等待UI完成一定程度后触发
package com.buy.apps.view;
import android.os.Handler;
import android.view.View;
/**
* 自动重试的Runnable, 用于等待UI完成一定程度后触发
* @author holmes
*
*/