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
.node { | |
cursor: pointer; | |
} | |
.node circle { | |
fill: #fff; | |
stroke: #f98415; | |
stroke-width: 1.5px; | |
} |
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/sh | |
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the | |
# CREATE block and create them in separate commands _after_ all the INSERTs. | |
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk. | |
# The mysqldump file is traversed only once. | |
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite | |
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite |
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
#Setup and launch an RHEL EC2 instance | |
#Ensure that the security group (firewall) allows access to port 8787 | |
#Login via SSH | |
#Guide: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html | |
ssh -i keyfile.pem ec2-user@ec2-11-22-33-44.compute-1.amazonaws.com | |
#Keyfile.pem is the name of your the keyfile you generated with AWS. | |
#RHEL users are either root or ec2-user | |
#ec2-11-22-33-44.compute-1.amazonaws.com is the "actuall" public name assigned by AWS |
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
#Original source: http://forums.macrumors.com/showthread.php?t=789978 | |
hdiutil compact /path/to/xxxxx.sparseimage |
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
parsedXml <- tryCatch( ParseAlert(xmlParse(alert.xml)), | |
error = function(e){ warning(paste("Problem encountered parsing alert XML for:",curMsgID,continuing)); | |
warning(geterrmessage()); | |
data.frame(NA) | |
return(NA) | |
} | |
) |
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
require(dplyr) | |
require(parallel) | |
require(foreach) | |
require(doParallel) | |
cpuCount <- detectCores() #From the parallel package | |
registerDoParallel(cores=cpuCount-1) #Don't take all cores. | |
dplyr({put dplyr data arguments here},.parallel=T) #Run dplyr in parallel. |
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
/** | |
* Retrieves all the rows in the active spreadsheet that contain data and logs the | |
* values for each row. | |
* For more information on using the Spreadsheet API, see | |
* https://developers.google.com/apps-script/service_spreadsheet | |
*/ | |
function readRows() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var rows = sheet.getDataRange(); | |
var numRows = rows.getNumRows(); |
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
# A quick way to pull a lat/lon table off Wikipedia for "all" US Army bases. | |
# SPARQL: on http://dbpedia.org/sparql | |
PREFIX owl: <http://www.w3.org/2002/07/owl#> | |
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
PREFIX foaf: <http://xmlns.com/foaf/0.1/> | |
PREFIX dc: <http://purl.org/dc/elements/1.1/> | |
PREFIX : <http://dbpedia.org/resource/> | |
PREFIX dbpedia2: <http://dbpedia.org/property/> |
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
# Geocoding in R using Google's API | |
require(RCurl) | |
require(XML) | |
require(data.table) | |
require(dplyr) | |
ridbLocs <- data.table(read.delim(file = "Data/ridbLocations.tsv")) | |
setnames(ridbLocs,c("original","locationType","simplified1","gCode","simplified","lat","lon")) | |
#' Model formula from my Google Sheet: |
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
#An Excel style "fill down" for Data Table. (.SD is the Subset of Data for each 'by' group) | |
dataTable[,setId:=.SD[1,setId],by=setNum] #TAG:USEFUL (Excel style fill down) |
OlderNewer