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 java.util.Arrays; | |
| public class ArrayBasedSorting { | |
| static void selectionSort(int[] arr) { | |
| /* | |
| * The index i is the position whose correct value we are seeking. | |
| * i.e. when i=3, we are searching for the value that should end up in | |
| * arr[3]. | |
| * At this time, we would already have placed the correct items |
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 termcolor | |
| from termcolor import colored, cprint | |
| # == Connect 4 ================================================================ | |
| # This is just a quick mockup of what a Connect Four game state could look | |
| # like. You probably want something more elaborate like what we saw in the | |
| # Pacman project. | |
| connect_4_board = [ |
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
| """Script to rename photos with their creation time. | |
| I whipped this up quickly to consolidate some photos as my Dropbox filled | |
| up and my computer was dying. It probably has enough code in here to be the | |
| starting point of a more robust script. | |
| If you are very serious about this you should probably use Automator on Mac | |
| or something like A Better Finder Rename 12. I personally did not want to | |
| spend any money on this, and Automator didn't do exactly the thing I wanted. |
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
| '''For the pairs of contiguous articles in singleissue_contiguous_dyads.csv, | |
| find the articles they mutually cite and get all the author/title info we can''' | |
| import pymssql | |
| import sys | |
| import csv, pickle | |
| from collections import defaultdict | |
| import re, Levenshtein | |
| import scipy as sp |
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
| """Neha's 32nd birthday Wordle! | |
| There may still be some bugs! It's ok we had fun. (Andrew also worked on this) | |
| """ | |
| import random | |
| import datetime | |
| from termcolor import colored |
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 xml.etree.ElementTree as ET | |
| import xmltodict | |
| root = ET.parse('../pubmed23n0001.xml').getroot() | |
| for article_obj in root.findall("PubmedArticle")[:10]: | |
| data_dict = xmltodict.parse(ET.tostring(article_obj)) | |
| print(data_dict) |
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 collections | |
| import glob | |
| import json | |
| import openreview | |
| guest_client = openreview.Client(baseurl='https://api.openreview.net') | |
| review_to_forum_map = {} |
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 argparse | |
| import csv | |
| import glob | |
| import json | |
| parser = argparse.ArgumentParser(description="") | |
| parser.add_argument("-d", "--disapere_dir", default="", type=str, help="") | |
| parser.add_argument("-l", "--label", default="", type=str, help="") |
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 argparse | |
| parser = argparse.ArgumentParser(description='') | |
| parser.add_argument('-o', '--output_dir', default='', type=str, help='') | |
| parser.add_argument('--mode', choices=('train', 'eval'), help='') | |
| parser.add_argument('-d', '--debug', action='store_true', help='') | |
| parser.add_argument('-s', '--year_start', default=2008, type=int, help='') |
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
| """Convert PreCo-formatted jsonl files into CoNLL format. | |
| Example usage: | |
| python preco_converter.py -i PreCo_1.0/train.jsonl -o train.txt # Removes singletons | |
| python preco_converter.py -i PreCo_1.0/train.jsonl -o train.txt -s # Keeps singletons | |
| Input: [input_file_name].jsonl (PreCo format) | |
| From https://preschool-lab.github.io/PreCo/, each line is a valid json object |
NewerOlder