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 count(digitgen): | |
"Takes an iterator which yields the digits of a number system and counts using it." | |
def subcount(digitgen, places): | |
if places == 1: | |
for d in digitgen(): | |
yield d | |
else: | |
for d in digitgen(): | |
for ld in subcount(digitgen, places - 1): |
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 Data.List (elemIndex) | |
-- | The 'permutations' function returns the list of all permutations of the argument. | |
-- | |
-- > permutations "abc" == ["abc","bac","cba","bca","cab","acb"] | |
permutations :: [a] -> [[a]] | |
permutations xs0 = xs0 : perms xs0 [] | |
where | |
perms [] _ = [] | |
perms (t:ts) is = foldr interleave (perms ts (t:is)) (permutations is) |
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 string | |
import pexpect | |
import sys | |
import random | |
import argparse | |
import os | |
from utils import colors | |
def is_server_running(host,port): | |
'''Try to connect to the server, send a join and expect a conn''' |
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
Front End: | |
Run tests functionality (we can run every time they hit run) | |
[X] Test output tab has a line for every line in the reference | |
[x] Modify the html in static/custom/templates/Rayage.html to mess with test output contents | |
[X] 'Test' button sends a message asking for a diff. Server responds with a JSON object | |
[ ] downgrade Test output from terminal to something simpler | |
[ ] change 'Logout' to 'Unspoof' when we are spoofing. (Can't figure this one out. I have code that should do this at static/custom/RayageMenu.js:70. It's not very high priority for me) | |
Submit assignment | |
message to server: "submit_assigment" |
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 "prime_iterator.h" | |
#include <vector> | |
#include <algorithm> //std::binary_search | |
//allocation and initialization of the static member variable | |
std::vector<unsigned int> PrimeIterator::prime_list{2,3}; | |
PrimeIterator::PrimeIterator() : position{0} { } | |
PrimeIterator::PrimeIterator(unsigned int pos) : position{pos} { |
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
aecho -n "Enter the last number to check for prime-iness: " | |
read MAX | |
while [ -n "$(echo ${MAX} | sed -E "s/[0-9]*//g")" -o ${MAX} -ge 274 ] | |
if [ ${MAX} -ge 274 ] | |
aecho "Sorry, the line buffers are too short to hold that many numbers." | |
aecho -n "Please enter a number: " | |
else | |
aecho -n "'${MAX}' is not a number. Please enter a number: " | |
end | |
read MAX |
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
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>jQuery UI Draggable - Events</title> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script> | |
<style> | |
.wrapper{ | |
overflow:hidden; /*make sure the wrapper has no dimension*/ | |
text-align: center; |
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
A = [-6, -8, 0, 3, 10, -8, 18] | |
def three_elems(A): | |
hashed_a = { val : index for (index, val) in enumerate(A) } | |
for i in range(len(A)): | |
for j in range(i+1,len(A)): | |
third_index = hashed_a.get(-1*(A[i] + A[j])) | |
if third_index is not None and third_index not in (i,j): |
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
{ | |
"metadata": { | |
"name": "Sieve of Eratosthenes" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
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
all: thread_prng adversary Makefile advantages | |
thread_prng: thread_prng.c | |
gcc --std=c99 -o thread_prng -lpthread thread_prng.c | |
adversary: adversary.c | |
gcc --std=c99 -o adversary adversary.c | |
advantages: adversary thread_prng | |
for option in r m; do \ |
OlderNewer