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
| sudo apt-get update | |
| sudo apt-get install libusb-dev | |
| git clone https://github.com/codazoda/hub-ctrl.c | |
| cd hub-ctrl.c | |
| gcc -o hub-ctrl hub-ctrl.c -lusb | |
| cp hub-ctrl .. | |
| cd .. |
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 random | |
| import time | |
| def shuffleRead(): | |
| first=True | |
| count=0 | |
| f=open('output.txt', 'r+') | |
| lines= f.readlines() | |
| if(first==True): | |
| first=False; |
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 random | |
| import time | |
| def prepareMessage(messageRaw): | |
| words_list = messageRaw.split() | |
| lineLength = 0 | |
| message = '' | |
| for word in words_list: | |
| if(lineLength == 0): | |
| message = message + word |
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/python2 | |
| import RPi.GPIO as GPIO | |
| import time | |
| import os | |
| GPIO.setmode(GPIO.BCM) | |
| buttonPin = 4 | |
| lightPin=3 | |
| GPIO.setup(buttonPin, GPIO.IN,pull_up_down=GPIO.PUD_UP) |
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
| public static void main(String[] args){ | |
| int[] myIntArray = new int[1,2,3,4,5,6,7,8]; | |
| int ans= 0; | |
| for(int i=0; i<myIntArray.length; i++){ | |
| if(myIntArray[i]%2=0){ | |
| ans++; | |
| } | |
| } | |
| System.out.println("There are"+ ans+" "+"even numbers |
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
| myIntArray= [1,2,3,4,5,6,7,8] | |
| ans=0 | |
| #pound signs are to comment, also there are no arrays in Python, only lists! Which are better | |
| for i in range(len(myIntArray)): | |
| if(myIntArray[i]%2=0): | |
| ans=ans+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
| class Node: | |
| #1 | |
| def __init__(self, val): | |
| self.val = val | |
| self.leftChild = None | |
| self.rightChild = None | |
| #2 | |
| def get(self): | |
| return self.val |
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
| class BST: | |
| #1 | |
| def __init__(self): | |
| self.root = None | |
| #2 | |
| def setRoot(self, val): | |
| self.root = Node(val) | |
| #3 | |
| def insert(self, val): | |
| if(self.root is None): |
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 | |
| import cv2 as cv | |
| import math | |
| face_cascade= cv.CascadeClassifier('C:\Program Files\opencv\sources\data\haarcascades\haarcascade_frontalface_default.xml') | |
| #direct path to the haarcascade, which is included in openCV | |
| pic= cv.imread('face.jpg') | |
| #the path to one image that OpenCV will convert to a numpy array | |
| gray= cv.imread('face.jpg,0) |
OlderNewer