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
| # MongoDB GridFile export | |
| CSV::foreach('/Volumes/Content/Dropbox/Code/reuse/reimport/licenses/licensefiles.csv',{headers: true}) {|r| puts %x[mongofiles -d github -l #{r[1].gsub(/^\.\/([^\/]+)\/([^\/]+)\/.*/,'"\1\|\2"')} get "#{r[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
| import java.util.LinkedList; | |
| public class LevenshteinDistance { | |
| public static final int NONE = 0; | |
| public static final int DELETE = 1; | |
| public static final int INSERT = 1; | |
| public static final int REPLACE = 2; | |
| private static int minimum(int a, int b, int c) { |
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
| #!/bin/bash | |
| os=`uname` | |
| # Python | |
| if [[ "$os" == 'Linux' ]]; then | |
| apt-get install -y python python-pip python-dev #python3 python3-pip python3-dev | |
| elif [[ "$os" == 'Darwin' ]]; then | |
| brew install python | |
| fi |
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
| # First enable multiverse in /etc/apt/sources.list | |
| # apt-get install revolution-r revolution-mkl | |
| # From the horse's mouth | |
| curl http://mran.revolutionanalytics.com/install/RRO-8.0.3-Ubuntu-14.04.x86_64.tar.gz | tar -xvz | |
| curl http://mran.revolutionanalytics.com/install/RevoMath-8.0.3.tar.gz | tar -xvz | |
| cd RRO* | |
| ./install.sh | |
| cd ../RevoMath/ | |
| ./RevoMath.sh |
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
| pip install bash_kernel |
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 createEdge (from, to, type) { | |
| var g = orient.getGraph(); | |
| var cmd = "CREATE EDGE " + type + " FROM " + from + " TO " + to; | |
| return g.command("sql", cmd); | |
| } |
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/env Rscript | |
| lics<-read.csv("~/Temp/csvdb/license-union-norownum.csv", header = TRUE, sep = ",", stringsAsFactors = FALSE) | |
| # Using dplyr | |
| licsgr<-dplyr::group_by(lics, gem) | |
| licsgrsum<-summarise(licsgr, list(license)) | |
| colnames(licsgrsum)<-c("gem", "licenses") |
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
| from pandas import DataFrame as df | |
| import pandas as pd | |
| lics = pd.read_csv("/Users/Mah/Temp/csvdb/license-union-norownum.csv") | |
| licsgr = lics.groupby('gem')['license'].apply(list) | |
| licsgr.columns = ['gem', 'licenses'] | |
| # But how do we convert Series to DataFrame in Pandas? |
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
| #!/bin/sh | |
| tr '[A-Z]' '[a-z]' <<(echo "lOWER mE") | |
| #$ lower me |
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
| library(igraph) | |
| library(magrittr) | |
| library(textir) | |
| library(Matrix) | |
| # fetch the network file | |
| download.file("http://www-personal.umich.edu/~mejn/netdata/lesmis.zip", "lesmis.zip", "auto") | |
| unzip("lesmis.zip") | |
| g <- read.graph("lesmis.gml", format = "gml") |