This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 在Linux终端使用sed命令,使用正则表达式时+没有被当作元字符 | |
# 1. 使用如下命令 | |
sed -i '/^[0-9]+/d' some.txt | |
cat some.txt | |
# 并不能够将数字开头的行删除 | |
# 2. 使用如下命令 | |
sed -i '/^[0-9]\+/d' some.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
在终端输入的命令被记录在history中 | |
只是输入history就可以看到从前的命令 | |
如果要再次执行从前的命令,只要 !1725 | |
!linenumber 即可 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
honwhy@eos:images$ find . -size 0 | |
./18342-106vq6i | |
./16601-1bgsvrc | |
./16601-v389qr | |
./16601-1lsd6ei | |
./21398-haoave | |
./18342-zwtoqd | |
./18342-1404c4x | |
./20513-1b0wtmo | |
./18342-14g3r6i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed -i '289,$d' filename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
http.createServer(function(req, res) { | |
if(req.url == '/') { | |
res.writeHead(200, {'Content-Type': 'text/html'}); | |
res.end(makeHtml()); | |
} else if(req.url == '/ajax302'){ | |
res.writeHead(302, { | |
'Content-Type': 'text/html', | |
//'Location': 'http://localhost:9000/forward' // alert 200 | |
'Location': 'https://github.com/join' // alert 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dump script from http://dubbo.apache.org/zh-cn/docs/dev/principals/dummy.html | |
JAVA_HOME=/usr/java | |
OUTPUT_HOME=~/output | |
DEPLOY_HOME=`dirname $0` | |
HOST_NAME=`hostname` | |
DUMP_PIDS=`ps --no-heading -C java -f --width 1000 | grep "$DEPLOY_HOME" |awk '{print $2}'` | |
if [ -z "$DUMP_PIDS" ]; then | |
echo "The server $HOST_NAME is not started!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MultiThreadHashMap { | |
private static final Object PRESENT = new Object(); | |
public static void main(String[] args) throws InterruptedException, BrokenBarrierException { | |
final Map<String,Object> map = new HashMap<>(); //let map do resize multiple times | |
int N = 1000; | |
final CyclicBarrier cyclicBarrier = new CyclicBarrier(N+1); | |
for (int i = 0; i < N; i++) { | |
new Thread(new Runnable() { | |
@Override | |
public void run() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.honey; | |
import javax.crypto.Cipher; | |
import javax.crypto.spec.IvParameterSpec; | |
import javax.crypto.spec.SecretKeySpec; | |
import java.nio.charset.StandardCharsets; | |
import java.util.Base64; | |
import java.util.Random; | |
public class AesDemo { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.honey; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.concurrent.*; | |
public class ConsumerQueueDemo { | |
public static void main(String[] args) { | |
//making hot spot code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.honey; | |
import java.io.File; | |
import java.io.IOException; | |
import java.net.InetSocketAddress; | |
import java.nio.ByteBuffer; | |
import java.nio.channels.SelectionKey; | |
import java.nio.channels.Selector; | |
import java.nio.channels.SocketChannel; | |
import java.util.ArrayList; |
OlderNewer