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 datetime | |
# requires python-dateutil (http://labix.org/python-dateutil) | |
from dateutil.relativedelta import relativedelta | |
def get_month_day_range(date): | |
""" | |
For a date 'date' returns the start and end date for the month of 'date'. | |
Month with 31 days: |
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
#!/bin/bash | |
IPT="/sbin/iptables" | |
# Server IP | |
SERVER_IP="$(ip addr show eth0 | grep 'inet ' | cut -f2 | awk '{ print $2}')" | |
# Your DNS servers you use: cat /etc/resolv.conf | |
DNS_SERVER="8.8.4.4 8.8.8.8" | |
# Allow connections to this package servers |
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
$hcidump --raw | |
> 04 3E 25 02 01 00 00 7C C2 DB A8 65 4C 19 02 01 06 15 16 95 | |
FE 50 20 AA 01 09 7C C2 DB A8 65 4C 0D 10 04 D5 00 28 02 AB | |
7C C2 DB A8 65 4C => mac address | |
Packet size vary from 37 to 41 | |
when 41 temp and humidity are set on the 2 last bytes before CRC | |
28 02 => Humidity => big endian reverse 0228 => to int => 552 => 55.2% |