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
| (defun mayoff:open-url-in-chrome (url) | |
| "Open URL in Google Chrome. I use AppleScript to do several things: | |
| 1. I tell Chrome to come to the front. If Chrome wasn't launched, this will also launch it. | |
| 2. If Chrome has no windows open, I tell it to create one. | |
| 3. If Chrome has a tab showing URL, I tell it to reload the tab, make that tab the active tab in its window, and bring its window to the front. | |
| 4. If Chrome has no tab showing URL, I tell Chrome to make a new tab (in the front window) showing URL." | |
| (when (symbolp url) | |
| ; User passed a symbol instead of a string. Use the symbol name. | |
| (setq url (symbol-name url))) | |
| (do-applescript (format " |
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
| """ | |
| Programming task | |
| ================ | |
| Implement the method iter_sample below to make the Unit test pass. iter_sample | |
| is supposed to peek at the first n elements of an iterator, and determine the | |
| minimum and maximum values (using their comparison operators) found in that | |
| sample. To make it more interesting, the method is supposed to return an | |
| iterator which will return the same exact elements that the original one would | |
| have yielded, i.e. the first n elements can't be missing. |
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
| """ | |
| Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
| BSD License | |
| """ | |
| import numpy as np | |
| # data I/O | |
| data = open('input.txt', 'r').read() # should be simple plain text file | |
| chars = list(set(data)) | |
| data_size, vocab_size = len(data), len(chars) |
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
| In [4]: np.arange(10).astype(object).mean(axis=0) | |
| Out[4]: 4.5 | |
| In [5]: np.__version__ | |
| Out[5]: '1.8.1' |
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
| # Generic Aliases | |
| alias ll='ls -latr' # List all file in long list format by modification time | |
| alias ..='cd ..' # Go up one directory | |
| alias ...='cd ../..' # Go up two directories | |
| alias ....='cd ../../..' # Go up three directories | |
| alias -- -='cd -' # Go back | |
| alias c='clear' # Clear Screen | |
| alias k='clear' # Clear Screen | |
| alias cls='clear' # Clear Screen | |
| alias _="sudo" # Execute with sudo |
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
| COPY ( | |
| select r.cluster_id, r.token_array from hotel4x.review as r where | |
| r.lang = 'en' and r.cluster_id in | |
| (SELECT h.cluster_id | |
| FROM hotel4x.hotel AS h | |
| INNER JOIN ( | |
| SELECT s.cluster_id, COUNT(*) AS source_count | |
| FROM hotel4x.source AS s |
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
| def delimited(filename, delimiter=' ', bufsize=4096): | |
| ''' | |
| Creates a generator of word from a file based on a delimiter (by default white space). | |
| ''' | |
| buf = '' | |
| with open(filename) as file: | |
| while True: | |
| newbuf = file.read(bufsize) | |
| if not newbuf: |
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
| #!/usr/bin/perl | |
| # Program to filter Wikipedia XML dumps to "clean" text consisting only of lowercase | |
| # letters (a-z, converted from A-Z), and spaces (never consecutive). | |
| # All other characters are converted to spaces. Only text which normally appears | |
| # in the web browser is displayed. Tables are removed. Image captions are | |
| # preserved. Links are converted to normal text. Digits are spelled out. | |
| # Adapted for the german language based on the script written by Matt Mahoney | |
| # http://mattmahoney.net/dc/textdata.html |
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
| <ref...> ... </ref> |
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
| #make sure you use macruby | |
| framework "ScriptingBridge" #let's use the scripting bridge framework | |
| # this is aweful - maybe a wrapper would be nice | |
| # you can ge this BundleIdentifier using the mdls | |
| # mdls -name kMDItemCFBundleIdentifier /Applications/Things.app | |
| things = SBApplication.applicationWithBundleIdentifier("com.culturedcode.things") |