Skip to content

Instantly share code, notes, and snippets.

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);
}
#include <Servo.h>
Servo servo1;
Servo servo2;
float theta1;
float theta2;
int pot1 = 0;
int pot2 = 1;
void setup() {
void explode(String message)
{
int count = 0;
do
{
commaPosition = message.indexOf(':');
if(commaPosition != -1)
{
Serial.println( message.substring(0,commaPosition));
@rkrishnasanka
rkrishnasanka / new_gist_file.m
Last active December 21, 2015 22:39 — forked from AhmedKammorah/new_gist_file
Async operations iOS
dispatch_queue_t queue = dispatch_get_global_queue(
DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(queue, ^{
//any thing
});
//ref
@rkrishnasanka
rkrishnasanka / wol.py
Created August 29, 2013 10:08
WAKE ON LAN
import socket
import struct
def wake_on_lan(macaddress):
""" Switches on remote computers using WOL. """
# Check macaddress format and try to compensate.
if len(macaddress) == 12:
pass
@rkrishnasanka
rkrishnasanka / app.js
Created August 1, 2013 08:19
test socket.io server
var express = require('express')
, app = express()
, server = require('http').createServer(app)
, path = require('path')
, io = require('socket.io').listen(server)
, spawn = require('child_process').spawn
// all environments
@rkrishnasanka
rkrishnasanka / g.py
Created July 28, 2013 13:24
HW 1 Problem 4 ,5 (uncomment relevant data)
from GF2 import one
def GF2_addLists(L1,L2): return [vx+ux for (vx,ux) in zip(L1,L2)]
def solve(u):
#data
data = {
'a':[one,one,one,0,0,0,0]
, 'b':[0,one,one,one,0,0,0]
@rkrishnasanka
rkrishnasanka / pxsshCommand.py
Last active May 31, 2022 07:18
uses pexpect to automate ssh login
import pxssh
def send_command(s, cmd):
s.sendline(cmd)
s.prompt()
print s.before
def connect(user, host, password):
try:
s = pxssh.pxssh()
@rkrishnasanka
rkrishnasanka / nmapscanner.py
Created July 7, 2013 11:47
Scans comma separated port list given by -p of host ip given by -H
import nmap
import optparse
def nmapScan(tgtHost, tgtPort):
nmScan = nmap.PortScanner()
nmScan.scan(tgtHost, tgtPort)
state = nmScan[tgtHost]['tcp'][int(tgtPort)]['state']
print " [*] " + tgtHost + " tcp/" + tgtPort + " " + state
def main():
@rkrishnasanka
rkrishnasanka / unzipper.py
Created July 7, 2013 10:53
Zip Password Cracker (requires dictionary)
import zipfile
import optparse
from threading import Thread
def extractFile(zFile, password):
try:
zFile.extractall(pwd = password)
print '[+] Found password ' + password + '\n'
except:
pass