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
dispatch_queue_t queue = dispatch_get_global_queue( | |
DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); | |
dispatch_async(queue, ^{ | |
//any thing | |
}); | |
//ref |
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
void explode(String message) | |
{ | |
int count = 0; | |
do | |
{ | |
commaPosition = message.indexOf(':'); | |
if(commaPosition != -1) | |
{ | |
Serial.println( message.substring(0,commaPosition)); | |
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
#include <Servo.h> | |
Servo servo1; | |
Servo servo2; | |
float theta1; | |
float theta2; | |
int pot1 = 0; | |
int pot2 = 1; | |
void setup() { |
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
int buf = 0; | |
int xcoordinate = 0; | |
int ycoordinate = 0; | |
void setup() | |
{ | |
// start serial port at 9600 bps and wait for port to open: | |
Serial.begin(115200); | |
} |
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
# Back-Propagation Neural Networks | |
# | |
# Written in Python. See http://www.python.org/ | |
# Placed in the public domain. | |
# Neil Schemenauer <[email protected]> | |
import math | |
import random | |
import string |
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
import urllib | |
import smtplib | |
import time | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
from random import randint | |
def sendemail(session,me,you,subject,html): | |
# Create message container - the correct MIME type is multipart/alternative. |
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
# Written by Raul Aguaviva as an exercise | |
# beware not optimized for speed :-) | |
from struct import * | |
import math | |
zigzag = [0, 1, 8, 16, 9, 2, 3, 10, | |
17, 24, 32, 25, 18, 11, 4, 5, | |
12, 19, 26, 33, 40, 48, 41, 34, | |
27, 20, 13, 6, 7, 14, 21, 28, |
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 POLY 0x8408 /* bits reversed for LSB-first */ | |
unsigned short crc = 0xffff; | |
while (len-- > 0) { | |
unsigned char ch = *bufp++; | |
for (i = 0; i < 8; i++) { | |
crc = (crc >> 1) ˆ ( ((ch ˆ crc) & 0x01) ? POLY : 0 ); | |
ch >>= 1; | |
} | |
} |
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
Walter Bright's MEM Package | |
--------------------------- | |
PREFACE: | |
-------- | |
The files, MEM.H and MEM.C which constitute the MEM package were originally | |
published in the March-April 1990 edition of Micro Cornucopia magazine, now | |
sadly out of print. The files as they appear in SNIPPETS have been edited |
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
import numpy as np | |
def run(): | |
# create a column vector | |
col_vec = np.array([[1], [2]]) | |
print "column vector" | |
print col_vec | |
# create a row vector | |
row_vec = np.array([[1, 2]]) |