This file contains 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 <stdio.h> | |
#define TABSTP 4 | |
/* TODO: read this string from argv, | |
to test different scenarios */ | |
char* input_str = "Something to test it"; | |
int nexttbstp (int position); | |
int printblank(int start, int end); |
This file contains 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 <stdio.h> | |
#include <stdlib.h> | |
int main (int argc, char **argv) | |
{ | |
signed short i, min, max; | |
i = min = max = 0; | |
while (++i) { |
This file contains 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
prompt () { | |
[[ $# = 1 ]] || exit 255 | |
mode="$1" | |
case "$mode" in | |
none) | |
export PS1="" | |
;; | |
off) | |
export PS1="$ " |
This file contains 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
def prime(n): | |
if n <= 1: | |
return False | |
for i in xrange(2, n): | |
if n % i == 0: | |
return False | |
return True |
This file contains 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 math.sqrt as sqrt | |
def prime4(n): | |
if n<=1: | |
return False | |
if n % 2 == 0 and n != 2: | |
return False | |
if n % 3 == 0 and n != 3: | |
return False |
This file contains 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 math.sqrt as sqrt | |
def prime2(n): | |
if n <= 1: | |
return False | |
# The sqrt is turned into an int() because of the | |
# deprecation warning I got for passing a float as argument | |
# to xrange() | |
for i in xrange(2, int(sqrt(n))): |
This file contains 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 math.sqrt as sqrt | |
def prime3(n): | |
if n<=1: | |
return False | |
if n % 2 == 0 and n != 2: | |
return False | |
for i in xrange(2, int(sqrt(n)), 2): | |
if n % i == 0: |
This file contains 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 sys | |
import random | |
def toBinary(n): | |
r = [] | |
while (n > 0): | |
r.append(n % 2) | |
n = n / 2 | |
return r |
This file contains 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
window.onload = function () { | |
var canvas = document.getElementById('myCanvas'); | |
var context = canvas.getContext('2d'); | |
context.beginPath(); | |
for (var i=100; i<= 200; i += 25) { | |
context.moveTo(i, 50); | |
context.lineTo(i, 150); |
This file contains 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
window.onload = function () { | |
var canvas = document.getElementById('myCanvas'); | |
var context = canvas.getContext('2d'); | |
var matrix = []; | |
var colors = ['yellow', 'red']; | |
//filling the matrix with style B-) | |
matrix.push([1, 1, 0]); | |
matrix.push([0, 1, 0]); |