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
UP = (-1, 0) | |
LEFT = ( 0, -1) | |
DOWN = ( 1, 0) | |
RIGHT = ( 0, 1) | |
class Turtle: | |
"""The turtle crawls over the matrix starting at some position. | |
The turtle knows how to turn left and go forward.""" | |
def __init__(self, nrows, ncols, x, y): | |
self.x = x |
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
# | |
# reddit comment cleaner | |
# Delete my comments from a particular subreddit | |
# | |
import argparse | |
import getpass | |
import praw | |
import logging | |
logging.basicConfig(level=logging.DEBUG) |
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 <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <assert.h> | |
#define SPACE ' ' | |
void | |
reverse_words(char *sent, size_t len) | |
{ |
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
if __name__ == "__main__": | |
pass |
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> | |
<head> | |
<title>Binary search</title> | |
</head> | |
<body> | |
Enter a space-separated list of integers in increasing order:<br/> | |
<input id="txtArray" type="text" size="80" value="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25"><br/> | |
Enter an integer to search for: | |
<input id="txtKey" type="text" size="4" value="22"><br/> | |
<input type="button" value="Initialize" onclick="onSearch();"> |
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
"""Behaves pretty much like cp -Pruv , except supports skipping directories. | |
Copy one directory to another recursively. If any subdirectories match a | |
specified regular expression pattern, they are not copied. | |
Also, directories containing a file called .nobackup are not backup up. | |
""" | |
import os | |
import os.path as P | |
import re |
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
<!-- | |
vim: shiftwidth=2 | |
--> | |
<html> | |
<head> | |
<title>Tower of Hanoi</title> | |
</head> | |
<body> | |
<script src="hanoi.js"></script> | |
Number of disks: |
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
<!-- | |
vim: shiftwidth=2 | |
--> | |
<html> | |
<head><title>Clobber</title></head> | |
<body> | |
<form> | |
<textarea id="textArea" readonly="true" rows="10" cols="70"></textarea><br/> | |
<input id="inputText" type="text" text="Enter some text here" size="50" value="Enter some Unicode here..."> | |
<input id="checkbox" type="checkbox">clobber the submitted text</input> |
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 | |
# | |
# Lessons learned: | |
# | |
# - must override object class to get __sizeof__ to work | |
# | |
class TrieNode(object): | |
def __init__(self, leaf): |
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 <map> | |
#include <set> | |
#include <algorithm> | |
#include <iostream> | |
using namespace std; | |
// | |
// Lessons learned: | |
// |