Skip to content

Instantly share code, notes, and snippets.

van9ogh@VAN9OGH $ wpa_passphrase test "mypasswd"
network={
ssid="test"
#psk="mypasswd"
psk=0e804f52de7e7565be873500fa038cef6a9e571f56d6757f419191f3b4fe65c6
}
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.100 192.168.2.200;
option domain-name-servers 8.8.8.8, 8.8.4.4;
option routers 192.168.2.1;
default-lease-time 600;
max-lease-time 7200;
}
sudo ifconfig wlan0 192.168.2.1 netmask 255.255.255.0
sudo dhcp -q -cf /etc/dhcpd/dhcpd.conf wlan0
sudo iptables -t nat -A POSTROUTING -o wlan2 -j MASQUERADE
sudo su
echo "1" /proc/sys/net/ipv4/ip_forward
# acl控制是有优先级的, 由于我们学校内部有一个视频网站, 因此看校内网默认放行.
acl school_video dst 10.28.102.174
http_access allow school_video
# 这里就是用来做阻塞的关键部分了, 看不明白不要紧, cp即可
acl media rep_mime_type video/flv video/x-flv
acl media rep_mime_type -i ^video/
acl media rep_mime_type -i ^video\/
acl media rep_mime_type ^application/vnd.ms.wms-hdr.asfv1
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 8888
iptables -t nat -A PREROUTING -i eth1 -p udp --dport 80 -j REDIRECT --to-port 8888
@ahappyforest
ahappyforest / nRF24L01.c
Last active December 17, 2015 18:09
nRF24L01.c test from http://gizmosnack.blogspot.com/2013/04/tutorial-nrf24l01-and-avr.html, this is a great tutorial!
#include <avr/io.h>
#include <stdio.h>
#define F_CPU 8000000UL // 8MHZ
#include <util/delay.h>
#include <avr/interrupt.h>
#include "nRF24L01.h"
#define DDR_CSN DDB4 // PB4
#define DDR_MOSI DDB5 // PB5
module YL69HumidityP {
provides interface Atm128AdcConfig;
uses interface MicaBusAdc as SoilHumidityAdc;
}
implementation
{
async command uint8_t Atm128AdcConfig.getChannel() {
return call SoilHumidityAdc.getChannel();
}
module YL69HumidityControlP {
provides {
interface SplitControl;
}
uses {
interface Timer<TMilli> as Delay;
interface GeneralIO as Power;
}
}
implementation {
configuration YL69HumidityC {
provides {
interface SplitControl;
interface Read<uint16_t>;
}
}
implementation {
components YL69HumidityControlP as Control;
components YL69HumidityP as Device;
components MicaBusC;
#ifndef SMART_IRRIGATION_H
#define SMART_IRRIGATION_H
#define RESERVED_LEN 1
// list of operation -> request_code
#define SET_SWITCH_STATUS_REQUEST 0x01// 设置传感器开关
#define GET_SWITCH_STATUS_REQUEST 0x02// 获取开关状态
#define GET_READING_REQUEST 0x03// 获取传感器采集的数据
#define SET_READING_PERIOD_REQUEST 0x04// 设置采集的周期