# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key
This file contains hidden or 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
1 // Copyright 2009 The Go Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style | |
3 // license that can be found in the LICENSE file. | |
4 | |
5 // +build ignore | |
6 | |
7 // Generate a self-signed X.509 certificate for a TLS server. Outputs to | |
8 // 'cert.pem' and 'key.pem' and will overwrite existing files. | |
9 | |
10 package main |
This file contains hidden or 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 main | |
import ( | |
"encoding/xml" | |
"fmt" | |
) | |
type MyXML struct { | |
XMLName xml.Name `xml:"item"` | |
Content interface{} `xml:"content"` |
This file contains hidden or 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
location ~ ^/icomet/.* { | |
rewrite ^/icomet/(.*) /$1 break; | |
proxy_read_timeout 60; | |
proxy_connect_timeout 60; | |
proxy_buffering off; | |
proxy_pass http://127.0.0.1:8100; | |
} |
This file contains hidden or 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
auto deleter = [](FILE* f) {fclose(f);}; | |
std::unique_ptr<FILE, decltype(deleter)> p(fopen("1.txt", "w"), | |
deleter); |
This file contains hidden or 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 static AccountInfo getAccInfo(Context context, String jid) { | |
synchronized (acclock) { | |
if (AccInfo == null) { | |
final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); | |
final String tmDevice, tmSerial, androidId; | |
tmDevice = "" + tm.getDeviceId(); | |
tmSerial = "" + tm.getSimSerialNumber(); | |
androidId = "" + android.provider.Settings.Secure.getString(context.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID); | |
UUID deviceUuid = new UUID(androidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode()); |
This file contains hidden or 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
@Override | |
public void onResume() { | |
super.onResume(); | |
LocalBroadcastManager manager = LocalBroadcastManager.getInstance(getActivity()); | |
IntentFilter filter = new IntentFilter(ACTION_EXAMPLE); | |
manager.registerReceiver(this.receiver, filter); | |
} |
This file contains hidden or 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
SOURCE="${BASH_SOURCE[0]}" | |
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink | |
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" | |
SOURCE="$(readlink "$SOURCE")" | |
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located | |
done | |
#如果执行脚本不是软链接,则只需这一行即可 | |
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" |
This file contains hidden or 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
//一、采用Handle与线程的sleep(long)方法 | |
class Timer1{ | |
//1. 定义一个Handler类,用于处理接受到的Message。 | |
Handler handler = new Handler() { | |
public void handleMessage(Message msg) { | |
// 要做的事情 | |
super.handleMessage(msg); | |
} | |
}; |
This file contains hidden or 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
func getActiveUserInzone(appid uint16, zone uint16) ([]*session.UserSession, error) { | |
var resp []*session.UserSession | |
keyname := fmt.Sprintf(userStatSetKey, appid, zone) | |
userids, err := SessionPool.Call(getSessionAddr(keyname)).SMEMBERS(keyname) | |
if err != nil { | |
return resp, errors.New(keyname + ":" + err.Error()) | |
} |