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
@Test | |
public void test_12306() throws NoSuchAlgorithmException, KeyManagementException { | |
SSLContext sc = SSLContext.getInstance("SSL"); | |
TrustManager[] tmArr={new X509TrustManager(){ | |
public void checkClientTrusted(X509Certificate[] paramArrayOfX509Certificate,String paramString) throws CertificateException{} | |
public void checkServerTrusted(X509Certificate[] paramArrayOfX509Certificate,String paramString) throws CertificateException {} | |
public X509Certificate[] getAcceptedIssuers() {return null;} | |
}}; | |
sc.init(null, tmArr, new SecureRandom()); | |
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); |
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
@Test | |
public void test_yeelink() { | |
String key = "my-key"; | |
String device_id = "12825"; | |
String sensor_id = "20872"; | |
Map<String, Object> data = new HashMap<String, Object>(); | |
data.put("value", 31.3); | |
String url = String.format("http://api.yeelink.net/v1.1/device/%s/sensor/%s/datapoints", device_id, sensor_id); | |
System.out.println("URL="+url); | |
Request req = Request.create(url, METHOD.POST); |
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 static void main(String[] args) { | |
int count = 0; | |
int[] array = new int[]{0, 12, 56, 58, 100, 134, 180, 200}; // 添加头尾 | |
for (int i = 0; i < array.length; i++) { | |
for (int j = i + 1; j < array.length; j++) { | |
if (array[j] - array[i] > 50) { | |
if (i + 1 == j) { | |
System.out.println("-1"); // 跳不过去了 | |
System.out.println("BAD At " + array[i] + " TO " + array[j]); | |
return; |
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 org.nutz.trans.aop; | |
public interface TransAop { | |
String NONE = "txNONE"; | |
String READ_UNCOMMITTED = "txREAD_UNCOMMITTED"; | |
String READ_COMMITTED = "txREAD_COMMITTED"; | |
String REPEATABLE_READ = "txREPEATABLE_READ"; | |
String SERIALIZABLE = "txSERIALIZABLE"; | |
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
#include <SPI.h> | |
#define WIZ550io_WITH_MACADDRESS 1 | |
#include <Ethernet.h> | |
#include "EthernetClient.h" | |
#include "PubSubClient.h" | |
#define WIZ550io_WITH_MACADDRESS 1 | |
#include <JsonParser.h> | |
using namespace ArduinoJson::Parser; |
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 org.nutz.ioc.impl; | |
import java.io.File; | |
/** | |
* 代理Properties文件,以便直接在Ioc配置文件中使用 | |
* | |
* @author wendal(wendal1985@gmail.com) | |
* @author zozoh(zozohtnt@gmail.com) | |
* |
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
// data is byte[] | |
// tmp is OutputStream | |
for (int i = 0; i < data.length; i++) { | |
int b = data[i]; | |
switch (b) { | |
case 0x55: | |
case 0xAA: | |
case 0xBB: | |
log.info("Found sp=" + Integer.toHexString(b)); | |
tmp.write(0xBB); |
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
#include <OneWire.h> | |
#include "DallasTemperature.h" | |
OneWire oneWire(8); | |
DallasTemperature sensors(&oneWire); | |
void setup() { | |
Serial.begin(9600); | |
sensors.begin(); | |
} |
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
# -*- coding: UTF-8 -*- | |
''' | |
Created on 2014-5-28 | |
快速打印南航的特价票 | |
@author: wendal | |
''' | |
import json |
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 org.nutz.dao.util; | |
import java.lang.reflect.InvocationHandler; | |
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
import java.lang.reflect.Proxy; | |
import org.nutz.dao.Dao; | |
import org.nutz.dao.FieldFilter; | |
import org.nutz.dao.TableName; |