Skip to content

Instantly share code, notes, and snippets.

:%s/r//g 删除DOS方式的回车^M
:%s= *$== 删除行尾空白
:%s/^(.*)n1/1$/ 删除重复行
:%s/^.{-}pdf/new.pdf/ 只是删除第一个pdf
:%s/<!--_.{-}-->// 又是删除多行注释(咦?为什么要说「又」呢?)
:g/s*^$/d 删除所有空行 :这个好用有没有人用过还有其他的方法吗?
Scrot是一个命令行下使用的截图工具,支持全屏、窗口、选取、多设备、缩略图、延时,甚至可以截图完毕之后指定某程序打开截好的图片。
在CentOS上的安装办法:
#yum install giblib giblib-devel
#wget http://linuxbrit.co.uk/downloads/scrot-0.8.tar.gz
# tar xvzf scrot-0.8.tar.gz
# cd scrot-0.8
// ==Tempermonkey Script==
// ==UserScript==
// @name My Fancy New Userscript
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description enter something useful
// @match http://search.maven.org/*
// @require http://code.jquery.com/jquery-1.8.2.js
// @copyright 2012+, You
package com.seveniu;
import java.util.ArrayList;
import java.util.List;
public class Permutation {
private int[] array; //传入数组
private int num; //从数组中选出n个数
private int[] result = new int[num]; //将选出的n个数存入数组
private int count = 0;
package com.kaishengit.Util;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
/**
* Created with IntelliJ IDEA.
* User: niu
@seveniu
seveniu / aopPivilegesManager
Created October 7, 2013 14:02
aop pivileges manager
package com.kaishengit.aopPivilegesManager;
import com.kaishengit.Util.ListUtil;
import com.kaishengit.dao.GroupDao;
import com.kaishengit.exception.ServiceException;
import com.kaishengit.pojo.Group;
import com.kaishengit.pojo.User;
import org.aspectj.lang.annotation.*;
import javax.inject.Inject;
@seveniu
seveniu / gist:77f8a490593ef0eb1f8b
Created June 4, 2014 10:54
一些有用的正则
带 http 的,url ---> (http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.alibaba.fastjson.JSON;
import org.msgpack.MessagePack;
import org.msgpack.annotation.Message;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@seveniu
seveniu / xpath.js
Last active August 29, 2015 14:05
xpath 获取 frameset 内的元素
function getElementsByXpath(xpath,document) {
var nodes = [];
var iterator = document.evaluate(xpath, document, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null );
try {
var thisNode = iterator.iterateNext();
while (thisNode) {
nodes.push(thisNode);
thisNode = iterator.iterateNext();
@seveniu
seveniu / http.lua
Last active August 29, 2015 14:05
lua socket http 请求
local http=require("http")
local httpRequest = {}
function httpRequest:new()
local obj = {}
self.__index = self
return setmetatable(obj,self)
end
function httpRequest:getInstance()