Skip to content

Instantly share code, notes, and snippets.

Avatar

Abe Burnett abeburnett

View GitHub Profile
@vtslab
vtslab / RGremlin.java
Last active Feb 20, 2019
Connecting to TinkerPop's gremlin server from R Studio with a java wrapper
View RGremlin.java
package rgremlin;
import org.apache.tinkerpop.gremlin.driver.*;
import org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper;
import org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry;
import org.json.simple.JSONObject;
@carlganz
carlganz / installOldPackages.R
Last active Apr 8, 2019
If you are upgrading from R 3.2 to R 3.3 you have to go to the hassle of redownloading all your packages. This code will try to download all your old packages.
View installOldPackages.R
# get library path
lib <- .libPaths()[1]
# does it end in 3.3?
if (grepl("*3.3",lib)) {
# if yes then assume old library is same place with 3.2 instead
oldlib <- gsub("*3.3","3.2",lib)
}
# check that old library exists
@swiftsam
swiftsam / r_cache.R
Created May 6, 2016
function caching function for R
View r_cache.R
####~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### Cache (memoization) utilities
###
### Purpose
### * Functions to save the output of time consuming functions to memory and
### return results quickly if we already have the answers
###
### Notes: Standard usage would go like this
### FunctionName <- function(){
### args <- c(as.list(environment()), list())
View postgres cheatsheet.md

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@jfaganUK
jfaganUK / sqlite_blob.r
Created Jan 12, 2015
Storing R Objects as a SQLite Blob
View sqlite_blob.r
#' ## Storing R Objects in a SQLite Database
#' Two packages we are using. The first is the ```RSQLite``` which will be used to create and manage an in-memory SQLite database. The second is ```igraph``` which I will use to create and visualize a random network. Some of the work I do is on network simulation. I often don't know the metrics I need from a simulated network when it's created, so I want to be able to store the networks that are created so that I can go back later and analyze them.
library(RSQLite)
library(igraph)
#' Create a database in memory.
con <- dbConnect(SQLite(), ":memory:")
#' The table has two columns, an *id* column and a column called *graph* which is a **blob** type. This type just stores binary data.
@albertbori
albertbori / Installation.md
Last active Jul 18, 2021
Automatically disable Wifi when an Ethernet connection (cable) is plugged in on a Mac
View Installation.md

Overview

This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.

Most the credit for these changes go to Dave Holland.

Requirements

  • Mac OSX 10+
  • Administrator privileges
@cybrox
cybrox / EmberChartComponent.js
Created Jun 5, 2014
Use Chart.js as a simple Ember.js component
View EmberChartComponent.js
/**
* This is a very simple example of an ember component to integrate
* nnick/chart.js in an ember.js application. Basically, it is simply
* using the components hook to create a ChartJS canvas element.
* Additionally, it supports an update property that allows you to
* let the chart re-rendet if your data or options change. Chart.js
* doesn't support updating its data so this will just create a new
* chart on the given canvas.
*
* Example usage in a handlebars template:
@sionc
sionc / rails-postgres-backbone-bootstrap-bootswatch
Last active Apr 6, 2020
Instructions on creating a new app using Ruby on Rails, Postgresql, Backbone.js, Twitter Boostrap, Bootstwatch
View rails-postgres-backbone-bootstrap-bootswatch
- Check rails version
$ rails -v
- To update rails
$ gem update rails
- Creating a new rails app using postgresql
$ mkdir rails_projects
$ cd rails_projects
$ rails new myapp --database=postgresql
@dwayne
dwayne / 1-introduction.md
Last active Aug 22, 2016
My notes from the book "Riding Rails with AngularJS by Ari Lerner".
View 1-introduction.md
@hmans
hmans / application.html.slim
Last active Apr 14, 2020
Application layout for Rails (4 and 5), Slim style.
View application.html.slim
doctype html
html
head
title My App
meta name="viewport" content="width=device-width, initial-scale=1.0"
= stylesheet_link_tag "application", media: 'all', 'data-turbolinks-track' => true
= javascript_include_tag "application", 'data-turbolinks-track' => true
= csrf_meta_tags
body