Skip to content

Instantly share code, notes, and snippets.

@benjic
benjic / RandomDistrobution.R
Created July 15, 2012 14:53
Random Normal Distribution
#First and foremost, we must have data. We see that there is a variable named RandomData and the asingment operation <- is assigning the value of rnorm(). rnorm(n) is a funciton which returns a vector of n values which lie within one standard deviation of the mean of 0.
RandomData <- rnorm(10000)
#hist displays a histogram of the vector of values.
hist(RandomData, col="blue")
#mean() computes the mean of the vector of values.
mean(RandomData)
#sd() computes the standard deviation of the vector of values.
sd(RandomData)
#summary() generates a table of all quartiles and max and min values.
@benjic
benjic / sumAn.go
Created February 10, 2013 16:15
A small function for summing the first n terms of the function 2 + 2n.
package main
func sumAn( n int) int {
sum := 0
for i := 0; i < n; i++ {
sum += 2 + (2 * i)
}
return sum
@benjic
benjic / sample.go
Last active December 18, 2015 18:19 — forked from codeeval/sample.py
package main
/*
Here is a sample construct that reads a file name supplied as an argument and
allows you, the programmer, to easily work with the supplied parameters. Have Fun!
*/
import (
"bufio"
"os"
@benjic
benjic / ProcessISOs.sh
Created July 12, 2013 02:41
A simple shell script to batch process ISOs. I use it with cron to schedule every night.
#/bin/bash
cd /home/benji/Videos;
for f in *.iso;
do
HandBrakeCLI -i $f -o `basename $f .iso`.mp4 --preset "Android";
if [ $? = 0 ]; then
rm -f $f;
fi
@benjic
benjic / ExampleClass.java
Created September 20, 2013 21:45
A sample use of a GIST to share code segements with other people.
package com.benjica.example
public class ExampleClass {
private final String PLACE = "World";
public static void main(String[] arguments) {
System.out.println("Hello " + PLACE + "!");
}
}
/*
* AlternativeTrip.java
* Date: 10/17/13
* Author: Benjamin Campbell <bc223913@umconnect.umt.edu>
* Abstract: A simple application that allows users to submit travel
* mechanisms that implement the BUsWalkBike class.
*/
package com.benjica.csci135.hw4;
@benjic
benjic / test.go
Last active August 29, 2015 14:05
package main
import "fmt"
func main() {
fmt.Println("Hey look, all vim!")
}
@benjic
benjic / test.go
Last active August 29, 2015 14:05
package main
import "fmt"
func main() {
fmt.Println("Hello all vim!")
}
boolean tangent = false;
float theta = 0;
float radius = 100;
float x_t = 0;
float y_t = 0;
float x_0;
float y_0;
; Declare global variables
section .data
hello: db 'Hello world!',10
helloLen: equ $-hello
; Jump into the action
section .text
global _start
; Meat and potatoes