View matchFloat.js
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
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++) |
View net_test.py
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
#encoding: UTF-8 | |
import sys | |
import time | |
import random | |
from socket import inet_aton | |
from ctypes import * | |
from winpcapy import * | |
from dpkt.ip import IP, IP_PROTO_TCP | |
from dpkt.tcp import TCP |
View ip-down
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/sh | |
PPP_IFACE="$1" | |
PPP_TTY="$2" | |
PPP_SPEED="$3" | |
PPP_LOCAL="$4" | |
PPP_REMOTE="$5" | |
PPP_IPPARAM="$6" | |
if [ "$PPP_IFACE" = "ppp0" ] |
View rs16.py
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
# Modified from | |
# http://en.wikiversity.org/wiki/Reed–Solomon_codes_for_coders | |
gf_exp = [0] * 65536 * 2 # Create list of 65536 elements. In Python 2.6+, consider using bytearray | |
gf_log = [0] * 65536 | |
gf_exp[0] = 1 | |
x = 1 | |
for i in range(1, 65535): | |
x <<= 1 | |
if x & 0x10000: |
View queble.user.js
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
// ==UserScript== | |
// @name 缺B乐 | |
// @namespace org.sorz.lab.queble | |
// @include http://www.acfun.tv/* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
String.prototype.correct = function () { | |
return this.toString() |
View twitter.mute.js
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
// origin: @ayanamist | |
// ==UserScript== | |
// @name Twitter Keyword Filter | |
// @namespace Twitter-Timeline-URL-Expand | |
// @description Replace t.co href of A tag with real url. | |
// @match https://twitter.com/ | |
// @version 1.1 | |
// ==/UserScript== | |
(function (window) { | |
var document = window.document; |
View DHT11.ino
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
#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(); |
View MMA7455L.py
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
#!/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) |
View DHT22.ino
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: @xierch | |
* License: MIT | |
* Known Issues: can't throw timeout exception if DHT22 broken. | |
*/ | |
#define DHT22_PIN 2 | |
void setup() { | |
pinMode(DHT22_PIN, INPUT_PULLUP); |
View flash-led.sh
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/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 |
OlderNewer