Skip to content

Instantly share code, notes, and snippets.

View abhijithanilkumar's full-sized avatar
💻
Why does GitHub have this feature?

Abhijith Anilkumar abhijithanilkumar

💻
Why does GitHub have this feature?
View GitHub Profile
@abhijithanilkumar
abhijithanilkumar / q6.py
Created August 3, 2017 06:43
question 6
from itertools import groupby
def splitWithIndices(a, c=' '):
p=0
for k,g in groupby(s, lambda x:x:==c):
q=p + sum(1 for i in g)
if not k:
yield p,q
p=q
#import pyserial package
import serial
#open the serial port
s = serial.Serial("/dev/ttyACM0") #change port after checking the port in which device is connected
#send probe
s.write('S')
#read ack
s.read()
#create the bytearray
b = bytearray(5) #bytearray of 5 bytes
using LightGraphs
using NetworkViz
using NetworkLayout
using ThreeJS
using Colors
main(window) = begin
"""ar = int(open(readdlm,"jagmesh1.mtx"))
x = ar[:,1]
y = ar[:,2]
f(a,b) = b,b+a # Function that computes the fibonacci number
function fibonacci(N::int64) # Function to find first N fibonacci numbers
a = 0 ; b = 1 # Errors can arise depending on the values taken for a and b.
for c in 1:N # Loop that runs N times
a,b = f(a,b)
@show a
end
end
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2011-2015 Regents of the University of California.
*
* This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
* contributors.
*
* ndnSIM is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
#Run this code in Escher
using NetworkViz
using LightGraphs
main(window) = begin
num = Signal(10)
width = Signal(1)
nodesize = Signal(0.2)
edgewidth = Signal(0.5)
toggle = Signal(true)
using ThreeJS
using Escher
using LightGraphs
using NetworkViz
g = CompleteGraph(10)
drawGraph(g,1)
@show typeof(g)