Skip to content

Instantly share code, notes, and snippets.

import pygame
import sys50,50
class Coordinate:
x = 0
y = 0
def __init__(self, x=0, y=0):
self.x = x
@asarver
asarver / camera_settings.py
Created March 23, 2014 00:34
change camera settings
import cv2
from subprocess import call, check_output
class CameraSettings:
def __init__(self, captureObject, device):
self.cap = captureObject
self.device = device
def getFocus(self):
@asarver
asarver / video_filtering.py
Last active August 29, 2015 13:57
Video Filtering
import cv2
import numpy
import sys
# python hsv_filter.py minH minS minV maxH maxS maxV
if __name__=="__main__":
defaultHSV = [0,0,0,255,255,255]
hsvArgs = sys.argv[1:]
@asarver
asarver / prob11.sh
Last active December 12, 2015 05:08
LOCK="file.lock"
FILENAME="prob15.txt"
TEMPFILE="temp_file.txt"
count=5
one=1
i=1
end=1000
while [ $i -lt $end ]
do
@asarver
asarver / main.c
Created December 6, 2011 22:20
Magic Square in C
#include <stdio.h>
#include <stdbool.h>
int main(void){
int dim;
printf("This program creates a magic square of a specified size.\n");
printf("The size must be an odd number between 1 and 99.\n");
printf("Enter the size of the magic square here: ");
scanf("%d", &dim);
@asarver
asarver / main.cpp
Created December 1, 2011 21:05
Magic Square
#include <iostream>
using namespace std;
bool check(int num) {
if (num % 2 == 0) {
return false;
}
if (num <= 0 || num > 99) {
return false;
}
@asarver
asarver / Puzzle2.py
Created July 24, 2011 04:52
Puzzle 2
file = open('puzzle2.txt', 'r')
while 1:
char = file.read(1) # read by character
if not char: break
if ord(char) == 32 or ord(char) >= 65 and ord(char) <= 90 or ord(char) >= 97 and ord(char) <= 122:
print char,
file.close()