Skip to content

Instantly share code, notes, and snippets.

@benfb
benfb / Rnotes.r
Last active August 29, 2015 14:19
# basic data setup
library(ggplot2)
d <- read.csv('/Users/ben/Documents/hampshire/S2015/collapse_phenomena/resistance.csv', header = TRUE, sep = ",")
load("/Users/ben/Downloads/drugs/DS0001/34933-0001-Data.rda")
d <- read.table('/Users/ben/Downloads/adolescenthealth/DS0001/21600-0001-Data.tsv', sep='\t', header=TRUE)
data <- da34933.0001 # store the dataframe in an easily accessible variable
# Convert to actual numerical variables
library(prettyR)
lbls <- sort(levels(data$PSILCY))
@benfb
benfb / Test1.ipynb
Created April 20, 2015 06:11
test notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@benfb
benfb / lyricloud_setup.md
Last active August 29, 2015 14:21
lyricloud_setup

On Nginx

adduser ben
gpasswd -a ben sudo
su - ben
mkdir .ssh
chmod 700 .ssh
vim .ssh/authorized_keys # add person key to file
vim /etc/ssh/sshd_config: PermitRootLogin no
sudo apt-get update
@benfb
benfb / stonednerdkitty
Created April 3, 2011 04:25
The kitty says 'still alive.'
Tonight I decided to set something interesting to happen every time I open the Terminal.
I decided to use cowsay (http://www.nog.net/~tony/warez/cowsay.shtml)
and fortune (http://en.wikipedia.org/wiki/Fortune_(Unix) to have a "cow" (kitten in my case)
give out random quotes from Portal, the Hitchhiker's Guide to the Galaxy and Monty Python and the Holy Grail.
I was successful, and decided to share my method.
First, you should install both programs:
brew install fortune
brew install cowsay
@benfb
benfb / restaurbot.rb
Created August 5, 2011 04:59
A simple restaurant robot
# Restaurbot
$done = false
orders = [
'pizza', 'macaroni'
]
puts 'Hello. What is your name?'
$name = gets.chomp.capitalize
@benfb
benfb / iAopen.sh
Created August 6, 2011 03:17
iAOpen
#!/bin/bash
open -A /Applications/iA\ Writer.app/ $1
@benfb
benfb / BBaileyDateable.java
Last active October 10, 2015 11:58
i/o and variables
// name:
// purpose: determine minimum age of a possible date
import java.util.Scanner; // imports the "Scanner" library, which allows the program to set up a new Scanner object
public class BBaileyDateable
{
// method main(): program starting point
public static void main( String[] args )
{
@benfb
benfb / Turtle.java
Last active October 10, 2015 22:38
turtles
import java.util.*;
import java.awt.*;
import java.io.*;
/**
* Class that represents a turtle which is similar to a Logo turtle.
* This class inherts from SimpleTurtle and is for students
* to add methods to.
*
* Copyright Georgia Institute of Technology 2004
@benfb
benfb / TurtleRunner.java
Last active October 10, 2015 22:38
TurtleRunner
public class TurtleRunner
{
public static void main(String args[])
{
//create a world for your turtles
World turtleWorld = new World(600,800); //creates the turtle canvas
//create a picture
Picture turtle = new Picture("images.jpg"); //lets java know where the picture is
@benfb
benfb / BBaileyInvoke.java
Created September 23, 2012 20:51
Invoke
// name:
// purpose: demonstrate further method prowess
public class BBaileyInvoke
{
// method piggyBank(): returns what the change is worth in cents
public static int piggyBank(int pennies, int nickles, int dimes, int quarters, int halfDollars) //creates the piggyBank method, which takes the arguments pennies, nickles, dimes, quarters, and halfDollars
{
double money = (pennies *.01) + (nickles*.05) + (dimes*.1) + (quarters*.25) + (halfDollars*.5); //calculates the amount of money needed