Skip to content

Instantly share code, notes, and snippets.

View tmosest's full-sized avatar

Tyler Moses tmosest

View GitHub Profile
@tmosest
tmosest / AWS EC2 Run phpDoc
Last active May 3, 2016 02:19
How to run phpDoc commands from an Amazon Web Services (AWS) EC2 instance for generating your own phpDocs for free.
1) Install composer see: https://gist.github.com/asugai/6694502
2) Edit composer.json to include phpdoc by adding:
"require": { "phpdocumentor/phpdocumentor": "2.*" }
3) Then update composer with:
composer update --verbose
@tmosest
tmosest / connect-to-an-aws-ec2-instance.txt
Created September 14, 2016 02:35
AWS EC2: Connecting To An Instance.
To open an AWS Instance you:
==========================
Windows Computers
==========================
1) Open Git Bash to the folder that contains my .pem file that you generated with your instance
2) Using Git command prompt you use chmod 400 my.pem to set the correct permissions on my.pem file
@tmosest
tmosest / sublime-command-line.md
Created September 19, 2016 22:51 — forked from adrianorsouza/sublime-command-line.md
launch sublime text from the command line

Launch Sublime Text from the command line on OSX

Sublime Text includes a command line tool, subl, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.

Requirements

  • Sublime text 2 or 3 installed in your system within Applications folder

Setup

# Enter your code here. Read input from STDIN. Print output to STDOUT
f <- file("stdin")
open(f)
getmode <- function(v) {
uniqv <- unique(v)
uniqv[which.max(tabulate(match(v, uniqv)))]
}
cases <- readLines(f,n=1)
@tmosest
tmosest / Solution.java
Created October 8, 2016 09:42
Hacker Rank: Basic Statistics Warmup in Java
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.util.Arrays;
public class Solution {
public static void main(String[] args) {
@tmosest
tmosest / Solution.java
Created October 9, 2016 08:42
Hackerrank: Day 0: Mean, Median, and Mode
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
@tmosest
tmosest / getHeight.java
Created October 9, 2016 08:46
Hackerrank: Day 22: Binary Search Tress
public static int getHeight(Node root) {
int heightLeft = 0;
int heightRight = 0;
if (root.left != null) {
heightLeft = getHeight(root.left) + 1;
}
if (root.right != null) {
heightRight = getHeight(root.right) + 1;
}
return (heightLeft > heightRight ? heightLeft : heightRight);
@tmosest
tmosest / levelOrder.java
Created October 9, 2016 09:03
Hackerrank: Day 23: BST Level-Order Traversal
static void levelOrder(Node root){
Queue<Node> queue = new LinkedList();
queue.add(root);
while(!queue.isEmpty()){
Node current = queue.remove();
System.out.print(current.data+" ");
if (current.left!=null) queue.add(current.left);
if (current.right!=null) queue.add(current.right);
}
@tmosest
tmosest / Solution.java
Created October 9, 2016 09:12
Hackerrank: Minimum Distance
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.util.Arrays;
public class Solution {
public static void main(String[] args) {
@tmosest
tmosest / solution.py
Created October 9, 2016 09:37
Hackerrank: PacMan DFS: Pyton3
class vector:
x=None
y=None
parent=None
dist=0
def __init__(self,x,y):
self.x=x
self.y=y