Skip to content

Instantly share code, notes, and snippets.

View jervisliu's full-sized avatar

Jervis Liu jervisliu

  • EaseMob Technologies
  • Beijing, China
View GitHub Profile
➜ ~ ab -n 1000 -c 100 http://www.easemob.com/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.easemob.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
@jervisliu
jervisliu / gist:48ea5ec38369d6f57578
Last active August 29, 2015 14:01
ansible-workable
Protocol 2
SyslogFacility AUTHPRIV
PasswordAuthentication yes
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
UsePAM yes
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
- name: SSH | Update the ssh security configuration (/etc/ssh/sshd_config)
template: src=etc_ssh_sshd_config.j2 dest=/etc/ssh/sshd_config owner=root group=root mode=0644
notify:
- restart ssh
-------------------- etc_ssh_sshd_config.j2
# Package generated configuration file
# See the sshd_config(5) manpage for details
@jervisliu
jervisliu / gist:3abe45359554b10f3d83
Last active August 29, 2015 14:01
ansible not workable
ssh_settings:
Port: "22"
Protocol: "2"
UsePrivilegeSeparation: "yes"
KeyRegenerationInterval: "3600"
ServerKeyBits: "768"
SyslogFacility: "AUTH"
LogLevel: "INFO"
LoginGraceTime: "120"
PermitRootLogin: "yes"
2014-05-27 14:36:09,143 ERROR (http-bio-8080-exec-18) [package org.apache.usergrid.rest.exceptions] - javax.ws.rs.WebApplicationException Server Error (500)
javax.ws.rs.WebApplicationException
at com.sun.jersey.server.impl.uri.rules.TerminatingRule.accept(TerminatingRule.java:66)
at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:137)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)
03-12 23:50:09.465: D/dalvikvm(9920): GC_CONCURRENT freed 949K, 13% free 15378K/17671K, paused 13ms+7ms, total 46ms
03-12 23:50:28.190: D/dalvikvm(9920): GC_CONCURRENT freed 824K, 13% free 15549K/17671K, paused 12ms+7ms, total 52ms
03-12 23:50:30.780: D/dalvikvm(9920): GC_FOR_ALLOC freed 302K, 14% free 15323K/17671K, paused 28ms, total 28ms
03-12 23:50:30.860: D/dalvikvm(9920): GC_FOR_ALLOC freed 18K, 13% free 15384K/17671K, paused 26ms, total 26ms
03-12 23:50:30.860: I/dalvikvm-heap(9920): Grow heap (frag case) to 15.973MB for 74896-byte allocation
03-12 23:50:30.890: D/dalvikvm(9920): GC_FOR_ALLOC freed 1K, 14% free 15456K/17799K, paused 25ms, total 25ms
03-12 23:50:30.960: D/dalvikvm(9920): GC_FOR_ALLOC freed 249K, 15% free 15289K/17799K, paused 26ms, total 26ms
03-12 23:50:30.960: I/dalvikvm-heap(9920): Grow heap (frag case) to 15.881MB for 74896-byte allocation
03-12 23:50:30.985: D/dalvikvm(9920): GC_FOR_ALLOC freed <1K, 15% free 15362K/17927K, paused 25ms, total 25ms
03-12 23:50:31.035: D/dalvikvm(9920
package com.easemob.push;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.UUID;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
private boolean sendFiletoServer(final String localFilePath,
final String remoteFilePath, final String appId, final String jid, final CloudOperationCallback listener) throws EaseMobException {
File sourceFile = new File(localFilePath);
// check file exists
if (!sourceFile.isFile()) {
Log.e(TAG, "Source file doesn't exist");
listener.onError("Source file doesn't exist");
return false;
}
HttpURLConnection connection = null;
private boolean sendFiletoServer(final String localFilePath,
final String remoteFilePath, final String appId, final String jid, final CloudOperationCallback listener) throws EaseMobException {
File sourceFile = new File(localFilePath);
// check file exists
if (!sourceFile.isFile()) {
Log.e(TAG, "Source file doesn't exist");
listener.onError("Source file doesn't exist");
return false;
}
HttpURLConnection connection = null;