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
from IPython.core.display import display, HTML | |
display(HTML("<style>.container { width:95% !important; }</style>")) | |
display(HTML("<style>.output_result { max-width:90% !important; }</style>")) | |
import numpy as np | |
np.set_printoptions(precision=3) | |
np.set_printoptions(linewidth=170) | |
np.set_printoptions(suppress=True) | |
np.random.seed(42) |
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
#!/usr/bin/env ruby | |
require "bundler/setup" | |
require "shoryuken/cli" | |
environment_path = File.expand_path("config/environment.rb") | |
require environment_path if File.exist?(environment_path) | |
Rails.application.eager_load! if defined?(Rails) |
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
# Source: http://blog.ivanilves.com/2016/rails-dump-fixtures-from-db/ | |
# Usage: | |
# * rake db:fixtures:dump to dump all models. | |
# * rake db:fixtures:dump MODELS="user billing_account" to dump only User and BillingAccount models. | |
# | |
namespace :db do | |
namespace :fixtures do |
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
module ActiveRecord | |
class SchemaDumper | |
def dump(stream) | |
header(stream) | |
extensions(stream) | |
enums(stream) | |
tables(stream) | |
trailer(stream) | |
stream | |
end |
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
#!/bin/zsh | |
# | |
# Highlight a given file and copy it as RTF. | |
# | |
# Simon Olofsson <[email protected]> | |
# | |
set -o errexit | |
set -o nounset |
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 pymongo | |
cl = pymongo.MongoClient() | |
db = cl.ner-dict | |
db = cl['ner-dict'] | |
c = db.dict | |
c.count | |
c.count() | |
qs = c.find() |
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
class Vocabulary | |
# @param [String] file_name Path to a word2vec vocabulary binary file | |
def initialize(file_name) | |
@file_name = file_name | |
@size = 0 | |
@vocabulary = {} | |
@word_count = 0 | |
read_file | |
end |