This file contains hidden or 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
#!/usr/bin/env python | |
import smbus | |
import time | |
class Accel(): | |
def __init__(self, dev=1, g=2): | |
self.bus = smbus.SMBus(dev) | |
self.set_range(g) |
This file contains hidden or 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
#define DHT11_PIN 2 | |
void setup() { | |
pinMode(DHT11_PIN, INPUT_PULLUP); | |
Serial.begin(115200, SERIAL_8E1); | |
} | |
void loop() { | |
if (Serial.available() > 0) { | |
byte in = Serial.read(); |
This file contains hidden or 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
#!/usr/bin/env python | |
#encoding: utf-8 | |
import urllib2 | |
from base64 import b64decode | |
LIST_URL = 'https://autoproxy-gfwlist.googlecode.com/svn/trunk/gfwlist.txt' | |
BLACK_FILE = 'gfw.url_regex.lst' | |
WHITE_FILE = 'cn.url_regex.lst' |
This file contains hidden or 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
#!/usr/bin/env python | |
#encoding: utf-8 | |
# Copyright (C) 2013 @XiErCh | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is |
This file contains hidden or 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: @xierch | |
* License: MIT | |
* Known Issues: can't throw timeout exception if DHT22 broken. | |
*/ | |
#define DHT22_PIN 2 | |
void setup() { | |
pinMode(DHT22_PIN, INPUT_PULLUP); |
This file contains hidden or 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
#!/usr/bin/env python | |
#encoding: utf-8 | |
# Copyright (C) 2013 @XiErCh | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is |
This file contains hidden or 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/sh | |
#set -x | |
export PATH="/bin:/sbin:/usr/sbin:/usr/bin" | |
IFNAME="eth0" | |
FULLSPEED=1200 # KiB/s | |
LED='/sys/class/leds/tp-link:blue:system/brightness' | |
while [ True ] | |
do |
This file contains hidden or 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
#!/usr/bin/env python | |
#encoding: utf-8 | |
import libnet | |
from libnet.constants import RAW4, RESOLVE, IPV4_H, UDP_H, IPPROTO_UDP | |
IFACE = 'wlan2' # Sending via the interface. | |
def sendto(sport, address): | |
l = libnet.context(RAW4, IFACE) |
This file contains hidden or 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
#!/usr/bin/python | |
import socket | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
s.bind(('0.0.0.0', 6000)) | |
while True: | |
data, addr = s.recvfrom(1024) | |
s.sendto(str(addr[1]), addr) |
This file contains hidden or 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
function matchFloat(s) { | |
f = s.replace(/[^\d]+/g, ''); | |
g = s.split(/\d/); | |
if (g.length == 0) | |
return f; | |
else if (g[0].contains('-')) | |
f = '-' + f; | |
for (var i=0; i<g.length - 1; i++) |
OlderNewer