通过第一篇《使用树莓派3B打造超强路由之一:初装》的努力,树莓派3B已经可以作为一台超低能耗、随身携带的开发用服务器来使用了。但这对于目标——打造超强路由而言,才刚刚开始。接下来,我们需要将其打磨成一台基本的无线路由器。
WARNING 本文所有指令均仅供参考,切勿无脑复制粘贴!
通过第一篇《使用树莓派3B打造超强路由之一:初装》的努力,树莓派3B已经可以作为一台超低能耗、随身携带的开发用服务器来使用了。但这对于目标——打造超强路由而言,才刚刚开始。接下来,我们需要将其打磨成一台基本的无线路由器。
WARNING 本文所有指令均仅供参考,切勿无脑复制粘贴!
| import org.apache.http.Header; | |
| import org.apache.http.HttpEntity; | |
| import org.apache.http.HttpResponse; | |
| import org.apache.http.client.methods.HttpGet; | |
| import org.apache.http.client.methods.HttpPost; | |
| import org.apache.http.conn.ssl.SSLConnectionSocketFactory; | |
| import org.apache.http.impl.client.CloseableHttpClient; | |
| import org.apache.http.impl.client.HttpClients; | |
| import org.apache.http.ssl.SSLContextBuilder; |
| # -*- coding:utf-8 -*- | |
| from tornado.ioloop import IOLoop | |
| from tornado.web import RequestHandler, Application | |
| class MiddleWare(object): | |
| def process_request(self, handler): | |
| pass | |
| def process_response(self, handler): | |
| pass |
| """ | |
| Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
| BSD License | |
| """ | |
| import numpy as np | |
| # data I/O | |
| data = open('input.txt', 'r').read() # should be simple plain text file | |
| chars = list(set(data)) | |
| data_size, vocab_size = len(data), len(chars) |
| @Configuration | |
| @ComponentScan | |
| public class Application { | |
| @Bean | |
| MessageService mockMessageService() { | |
| return new MessageService() { | |
| public String getMessage() { | |
| return "Hello Spring"; | |
| } | |
| }; |
The MySQL slow query log is a difficult format to extract information from. After looking at various examples with mixed results, I realized that it's much easier to configure MySQL to write the slow query log to a table in CSV format!
From the MySQL documentation:
By default, the log tables use the CSV storage engine that writes data in comma-separated values format. For users who have access to the .CSV files that contain log table data, the files are easy to import into other programs such as spreadsheets that can process CSV input.
Note: don't forget to open up permissions on your slow query log CSV file so logstash can read it!
# enable slow query log| -- Based on the original articel at http://www.codeproject.com/Articles/22824/A-Model-to-Represent-Directed-Acyclic-Graphs-DAG-o | |
| -- Here is a port to MySQL | |
| -- Edge table | |
| DROP TABLE IF EXISTS `Edge`; | |
| CREATE TABLE IF NOT EXISTS `Edge` ( | |
| `id` int(11) NOT NULL, | |
| `entry_edge_id` int(11) DEFAULT NULL COMMENT 'The ID of the incoming edge to the start vertex that is the creation reason for this implied edge; direct edges contain the same value as the Id column', | |
| `direct_edge_id` int(11) DEFAULT NULL COMMENT 'The ID of the direct edge that caused the creation of this implied edge; direct edges contain the same value as the Id column', | |
| `exit_edge_id` int(11) DEFAULT NULL COMMENT 'The ID of the outgoing edge from the end vertex that is the creation reason for this implied edge; direct edges contain the same value as the Id column', |
| #!/bin/sh | |
| # Licensed to the Apache Software Foundation (ASF) under one or more | |
| # contributor license agreements. See the NOTICE file distributed with | |
| # this work for additional information regarding copyright ownership. | |
| # The ASF licenses this file to You under the Apache License, Version 2.0 | |
| # (the "License"); you may not use this file except in compliance with | |
| # the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| import java.util.ArrayList; | |
| import java.util.List; | |
| import java.util.Random; | |
| public class GCLimit { | |
| static public void main(String[] args) { | |
| Random random = new Random(); | |
| List<String> interned = new ArrayList<>(); | |
| while(true) { | |
| int length = random.nextInt(100); |
| # Feel free to change this path of course (and keys_zone value as well, but also change the usage of it below). | |
| proxy_cache_path /var/www/cache/resized levels=1:2 keys_zone=resizedimages:10m max_size=1G; | |
| # Gzip was on in another conf file of mine...You may need to uncomment the next line. | |
| #gzip on; | |
| gzip_disable msie6; | |
| gzip_static on; | |
| gzip_comp_level 4; | |
| gzip_proxied any; | |
| # Again, be careful that you aren't overwriting some other setting from another config's http {} section. |