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 requests | |
| import csv | |
| import os | |
| import json | |
| import re | |
| from bs4 import BeautifulSoup | |
| import mechanize | |
| from random import choice | |
| user_agents = ['Mozilla/5.0 (X11; U; Linux; i686; en-US; rv:1.6) Gecko Debian/1.6-7','Konqueror/3.0-rc4; (Konqueror/3.0-rc4; i686 Linux;;datecode)','Opera/9.52 (X11; Linux i686; U; en)'] | |
| random_user_agent = choice(user_agents) | 
  
    
      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
    
  
  
    
  | (define (crackle-pop) | |
| (define (divisible a b) | |
| (= (mod a b) 0)) | |
| (define (crackle-popper a b) | |
| (if (<= a b) (crackle-popper (+ a 1) b | |
| (cond | |
| ((and (divisible a 3) (divisible a 5)) (display "CracklePop") (newline)) | |
| ((divisible a 3) (display "Crackle") (newline)) | |
| ((divisible a 5) (display "Pop") (newline)) | |
| )))) | 
  
    
      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
    
  
  
    
  | (function (window, undefined) { | |
| var directiveFactories = {}; | |
| /** | |
| * @description Register directive factory functions | |
| * | |
| * @param {String} name Name of the directive | |
| * @param {Function} factory The factory function | |
| */ | 
  
    
      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
    
  
  
    
  | function ArrayAdditionI(arr) { | |
| var valMap = {}; // Cache sums | |
| arr.sort(function(a,b) { return a - b;}); | |
| var largestNum = arr.pop(); | |
| for (var i = 0; i < arr.length; i++) { | |
| var combos = Object.keys(valMap); | |
| for (var j = 0; j < combos.length; j++) { | |
| var newCombo = arr[i] + (+combos[j]); | |
| if (newCombo === largestNum) return "true"; | 
  
    
      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
    
  
  
    
  | function move(n, f, d, t) { | |
| if (n > 0) { | |
| move(n - 1, f, t, d); | |
| d.push(f.pop()); | |
| move(n - 1, t, d, f); | |
| } | |
| } | 
  
    
      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
    
  
  
    
  | public static int findElement(int[] a, int l, int r, int x){ | |
| int m = (l+r)/2; | |
| int t = -1; | |
| if(x == a[m]) return m; | |
| if(l < r){ | |
| if(a[l] == a[m]){ | |
| if(x == a[l]) | |
| t = l; | 
  
    
      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
    
  
  
    
  | public static final int STR_SIZE(int n) { | |
| float bytesPerChar = Charset.defaultCharset().newEncoder().maxBytesPerChar(); | |
| return ((n+1) * (int)bytesPerChar); //1 xtra null char | |
| } | 
  
    
      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
    
  
  
    
  | public synchronized String getString(int offset) { | |
| contents.position(offset); | |
| String new_str = ""; | |
| while(true){ | |
| char a = contents.getChar(); | |
| if(a == '\0') break; | |
| new_str += a; | |
| } | |
| return new_str; | |
| } | 
  
    
      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
    
  
  
    
  | (* Name: Alan Lin | |
| Assignment: Problem Set 6 -> Namer | |
| *) | |
| module Namer = | |
| struct | |
| type typ = IntType | BoolType | |
| type value = BoolValue of int | IntValue of int | |
| type ast = Const of int * typ | |
| | App of string * ast list | 
  
    
      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
    
  
  
    
  | let rec sublists a = match a with | |
| [] -> [[]] | |
| |first::rest -> let b = sublists rest in | |
| let c = List.map (fun g -> first::g) b in | |
| c @ b;; | |
| (* | |
| val sublists : 'a list -> 'a list list = <fun> | |
| # let a = [1;2;3];; | |
| val a : int list = [1; 2; 3] | 
NewerOlder