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
/** | |
* Changes XML to JSON | |
* Modified version from here: http://davidwalsh.name/convert-xml-json | |
* @param {string} xml XML DOM tree | |
*/ | |
function xmlToJson(xml) { | |
// Create the return object | |
var obj = {}; | |
if (xml.nodeType == 1) { |
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
from nonebot.adapters import Event, Message | |
from nonebot.params import EventPlainText, CommandArg | |
from nonebot.plugin.on import on_message, on_command | |
from nonebot.adapters.onebot.v11.message import MessageSegment | |
import os | |
import ast | |
import json | |
import shelve | |
import aiohttp |
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
/** | |
* Author: Michael Fields | |
* Source: http://wordpress.mfields.org/2010/set-default-terms-for-your-custom-taxonomies-in-wordpress-3-0/ | |
* Thanks a lot for the nice tweak | |
*/ | |
/** | |
* Define default terms for custom taxonomies in WordPress 3.0.1 | |
* |
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
//语言和编码 | |
<?php language_attributes(); ?> //语言属性 | |
//根据不同情况来读取 title | |
<?php | |
global $page, $pages; | |
wp_title( '|', true, 'right'); //在标题的左方或右方 | |
bloginfo( 'name' ); //博客的名称 | |
$site_description = get_bloginfo( 'description', 'Display' ); //博客的描述 | |
if( $site_description && ( is_home() || is_front_page() ) ) //如果是首页,则输出博客名称和描述 |
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
import java.lang.reflect.Field; | |
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
/** | |
* 方法类 | |
* @author syh | |
* | |
*/ |
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
[mysqld] | |
# /etc/my.cnf | |
performance_schema = 0 | |
innodb_buffer_pool_size=5M | |
innodb_log_buffer_size=256K | |
query_cache_size=0 | |
max_connections=10 | |
key_buffer_size=8 | |
thread_cache_size=0 | |
host_cache_size=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
//A Kotlin object (singleton) that handles the copying with mulitple different arguments | |
object CopyBytes { | |
@Throws(IOException::class) | |
fun copy(input: InputStream, output: OutputStream) { | |
//Creating byte array | |
val buffer = ByteArray(1024) | |
var length = input.read(buffer) | |
//Transferring data |
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
// copy from https://stackoverflow.com/a/49063199/5279354 | |
Retrofit retrofit = new Retrofit.Builder() | |
.baseUrl(YOUR_BASE_URL) | |
.client(getUnsafeOkHttpClient().build()) | |
.build(); | |
public static OkHttpClient.Builder getUnsafeOkHttpClient() { | |
try { |
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
<?xml version="1.0" encoding="utf-8"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
android:shape="line"> | |
<stroke | |
android:color="#C7B299" | |
android:dashWidth="10px" | |
android:dashGap="10px" | |
android:width="1dp"/> | |
</shape> |
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 NetWorkUtils { | |
public static String getIPAddress(boolean useIPv4) { | |
List<NetworkInterface> interfaces = Collections.list(NetworkInterface.getNetworkInterfaces()); | |
for (NetworkInterface intf : interfaces) { | |
List<InetAddress> addrs = Collections.list(intf.getInetAddresses()); | |
for (InetAddress addr : addrs) { | |
if (!addr.isLoopbackAddress()) { | |
String sAddr = addr.getHostAddress(); | |
//boolean isIPv4 = InetAddressUtils.isIPv4Address(sAddr); | |
boolean isIPv4 = sAddr.indexOf(':')<0; |
NewerOlder