Skip to content

Instantly share code, notes, and snippets.

View abeburnett's full-sized avatar

Abe Burnett abeburnett

  • Ogden, UT
View GitHub Profile
@vtslab
vtslab / RGremlin.java
Last active February 20, 2019 22:22
Connecting to TinkerPop's gremlin server from R Studio with a java wrapper
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 April 8, 2019 17:23
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.
# 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 15:57
function caching function for 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())
@apolloclark
apolloclark / postgres cheatsheet.md
Last active March 7, 2024 13:53
postgres cheatsheet

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 January 12, 2015 18:26
Storing R Objects as a SQLite Blob
#' ## 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 April 19, 2024 00:16
Automatically disable Wifi when an Ethernet connection (cable) is plugged in on a Mac

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 June 5, 2014 12:39
Use Chart.js as a simple Ember.js component
/**
* 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 April 6, 2020 17:35
Instructions on creating a new app using Ruby on Rails, Postgresql, Backbone.js, Twitter Boostrap, Bootstwatch
- 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 August 22, 2016 04:37
My notes from the book "Riding Rails with AngularJS by Ari Lerner".
@wadewegner
wadewegner / gettoken_local.py
Last active February 24, 2023 00:39
Simple Python scripts for making a token request against the Force.com REST APIs. The first does not include the security token and the second does. You will want to use the second one.
import requests
consumer_key = "YOUR_CONSUMER_KEY"
consumer_secret = "YOUR_CUSTOMER_SECRET"
username = "YOUR_USER_NAME"
password = "YOUR_PASSWORD"
payload = {
'grant_type': 'password',
'client_id': consumer_key,