Skip to content

Instantly share code, notes, and snippets.

from gensim.models import KeyedVectors
# Load gensim word2vec
w2v_path = '<Gensim File Path>'
w2v = KeyedVectors.load_word2vec_format(w2v_path)
import io
# Vector file, `\t` seperated the vectors and `\n` seperate the words
"""

Technical details for https://stackoverflow.com/a/44169445/6730571

Details of investigation:

On a base system, /usr/bin/java is a symlink that points to /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, which is an Apple wrapper tool that locates and executes the actual java.

(Do not touch anything in those 2 system directories. It should actually be impossible due to "System Integrity Protection" anyway.)

If you don't have Java installed, attempting to execute java will open a dialog that invites you to install it.

@sheldonkhall
sheldonkhall / movieAnalysis.ipynb
Created November 11, 2016 10:35
Jupyter notebook related to Grakn Pandas Celebrities medium post.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Frozenfire92
Frozenfire92 / gist:3627e38dc47ca581d6d024c14c1cf4a9
Last active October 20, 2021 20:58
Install Scala and SBT using apt-get on Ubuntu 16.04 or any Debian derivative using apt-get
## Java
sudo apt-get update
sudo apt-get install default-jdk
## Scala
sudo apt-get remove scala-library scala
sudo wget http://scala-lang.org/files/archive/scala-2.12.1.deb
sudo dpkg -i scala-2.12.1.deb
sudo apt-get update
sudo apt-get install scala
@mick001
mick001 / mice_imp.R
Created October 4, 2015 10:57
Imputing missing data with R; MICE package: Full article at http://datascienceplus.com/imputing-missing-data-with-r-mice-package/
# Using airquality dataset
data <- airquality
data[4:10,3] <- rep(NA,7)
data[1:5,4] <- NA
# Removing categorical variables
data <- airquality[-c(5,6)]
summary(data)
#-------------------------------------------------------------------------------
@bonzanini
bonzanini / config.py
Last active April 18, 2024 11:57
Twitter Stream Downloader
consumer_key = 'your-consumer-key'
consumer_secret = 'your-consumer-secret'
access_token = 'your-access-token'
access_secret = 'your-access-secret'
@jcheng5
jcheng5 / dyselect.R
Last active October 14, 2015 05:36
Interactive date range selection using dygraphs
library(shiny)
library(dygraphs)
# Helper function to present Shiny controls in a dialog-like layout
dialogPage <- function(outputControl) {
bootstrapPage(
tags$style("
html, body { width: 100%; height: 100%; overflow: none; }
#dialogMainOutput { position: absolute; top: 10px; left: 10px; right: 10px; bottom: 40px; }
#dialogControls {
@nucliweb
nucliweb / gist:f984b9fc75a1c82ef1a1
Last active June 29, 2022 09:26
Sublime Text 3 on OS X Terminal

Sublime Text 3 on OS X Terminal

By creating link

Linking into /usr/bin with sudo:

$ sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/bin/sbl
@jcheng5
jcheng5 / debounce.R
Last active October 20, 2021 04:54
reactive debounce for Shiny
# Returns a reactive that debounces the given expression by the given time in
# milliseconds.
#
# This is not a true debounce in that it will not prevent \code{expr} from being
# called many times (in fact it may be called more times than usual), but
# rather, the reactive invalidation signal that is produced by expr is debounced
# instead. This means that this function should be used when \code{expr} is
# cheap but the things it will trigger (outputs and reactives that use
# \code{expr}) are expensive.
debounce <- function(expr, millis, env = parent.frame(), quoted = FALSE,
@lawlesst
lawlesst / rdflib_stardog.py
Last active July 14, 2021 03:38
Example code for working with Stardog from Python.
"""
Example code for connecting to Stardog (http://stardog.com/) with
Python's RDFLib (http://github.com/rdflib).
See longer description: http://lawlesst.github.io/notebook/rdflib-stardog.html
"""