Skip to content

Instantly share code, notes, and snippets.

View darrenrogan's full-sized avatar

Darren Rogan darrenrogan

View GitHub Profile
package darren.rogan;
public class SolutionImpl {
String permute(String text){
int length = text.length();
boolean[] used = new boolean[length];
public class Question {
void arrayquestion(){
int[] numbs = new int[]{1, 3, 5, 8, 9, 2, 6, 7, 6, 8, 9};
//int[] numbs = new int[]{1, 3, 5, 8, 1, 2, 6, 7, 6, 8, 9};
//int[] numbs = new int[]{10, 1, 2, 3, 4, 5, 6, 7};
//int[] numbs = new int[]{1, 1};
int hops = arrayquestion_sub(numbs,0,1,numbs.length,1);
System.out.println(hops);
@darrenrogan
darrenrogan / gist:6432857
Created September 4, 2013 04:48
java algorithm, that searchs a tree for two nodes that have a difference k, and return the common ancestor
//Given a binary search tree
//write an algorith the common ancestor
//who's difference = k
//assume the value = int
public class Tree{
TreeNode root;
int size;
...
package objsets
import common._
import TweetReader._
import scala.annotation._
/**
* A class to represent tweets.
*/
class Tweet(val user: String, val text: String, val retweets: Int) {
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@darrenrogan
darrenrogan / add_gh_key.sh
Last active January 13, 2016 01:48
This is a simple script that adds a github user to the ssh key authorized keys
# Usage: add_gh_key <github username>
# Credit - https://github.com/darrenrogan
function add_gh_key() {
NAME=$1 && KEY="$(curl -s https://github.com/$NAME.keys)" && echo "$KEY" $NAME >> ~/.ssh/authorized_keys
}
Just for future reference, running this on my pc now.
aws s3 cp images s3://restspace-restarea-photo/images --recursive --acl public-read
Using an extension called wintee to write to a text file (and the console at the same time). I think tee is build in for osx.
@darrenrogan
darrenrogan / folder_sizes.sh
Created August 13, 2017 06:50
Mac get list of folders with sizes
sudo du -hd 5 * > /tmp/folder_size.txt
aws --profile restspace s3 sync s3://restspace-restarea-images s3://restspace-restarea-photo-prod
@darrenrogan
darrenrogan / export.sh
Created July 30, 2018 03:42 — forked from chrisdiana/export-cognito-users.sh
Export AWS Cognito User Pool
aws --profile production cognito-idp list-users --user-pool-id us-west-2_XXXXXXXXX --output table > ~/users.txt