This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //export PS1="\u@\h:\W \$ " | |
| //export PS1="\[\e[30;46m\]\u@\h:\W \\$ \[\e[0m\]" | |
| [[ -s "/Users/dwightk/.rvm/scripts/rvm" ]] && source "/Users/dwightk/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | |
| function parse_git_branch { | |
| git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
| } | |
| export PS1="🍔 \[\033[01;35m\]\u@\h:\[\033[01;34m\]\$(parse_git_branch) \[\033[01;32m\]\w \[\033[01;34m\]>\[\e[0m\] " | |
| alias ll='ls -lG' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-get install cowsay | |
| sudo apt-get install fortune | |
| sudo apt-get install lolcat | |
| sudo apt-get install sl | |
| sudo apt-get install figlet | |
| sudo apt-get install toilet | |
| sudo apt-get install cmatrix |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ConsoleLog { | |
| public static final String RESET = "\u001B[0m"; | |
| public static final String BLACK = "\u001B[30m"; | |
| public static final String RED = "\u001B[31m"; | |
| public static final String GREEN = "\u001B[32m"; | |
| public static final String YELLOW = "\u001B[33m"; | |
| public static final String BLUE = "\u001B[34m"; | |
| public static final String PURPLE = "\u001B[35m"; | |
| public static final String CYAN = "\u001B[36m"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # gh-dl-release! It works! | |
| # | |
| # This script downloads an asset from latest or specific Github release of a | |
| # private repo. Feel free to extract more of the variables into command line | |
| # parameters. | |
| # | |
| # PREREQUISITES | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # Author: Stefan Buck | |
| # https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447 | |
| # | |
| # | |
| # This script accepts the following parameters: | |
| # | |
| # * owner | |
| # * repo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public int getLongestCommonSubstring(String str1, String str2) { | |
| int arr[][] = new int[str2.length() + 1][str1.length() + 1]; | |
| int max = Integer.MIN_VALUE; | |
| for (int i = 1; i <= str2.length(); i++) { | |
| for (int j = 1; j <= str1.length(); j++) { | |
| if (str1.charAt(j - 1) == str2.charAt(i - 1)) { | |
| arr[i][j] = arr[i - 1][j - 1] + 1; | |
| if (arr[i][j] > max) | |
| max = arr[i][j]; | |
| } else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class LCS { | |
| public static void main(String[] args) { | |
| // TODO Auto-generated method stub | |
| String str1 = "AGGTAB"; | |
| String str2 = "GXTXAYB"; | |
| LCS obj = new LCS(); | |
| System.out.println(obj.lcs(str1, str2, str1.length(), str2.length())); | |
| System.out.println(obj.lcs2(str1, str2)); | |
| } | |
| //Recursive function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class EditDistance { | |
| public static void main(String[] args) { | |
| // TODO Auto-generated method stub | |
| String str1 = "march"; | |
| String str2 = "cart"; | |
| EditDistance ed = new EditDistance(); | |
| System.out.println(ed.getMinConversions(str1, str2)); | |
| } | |
| public int getMinConversions(String str1, String str2) { | |
| int dp[][] = new int[str1.length() + 1][str2.length() + 1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| import java.lang.*; | |
| import java.io.*; | |
| class ShortestPath { | |
| static final int V = 9; | |
| int minDistance(int dist[], Boolean sptSet[]) { | |
| int min = Integer.MAX_VALUE, min_index = -1; | |
| for (int v = 0; v < V; v++) | |
| if (sptSet[v] == false && dist[v] <= min) { | |
| min = dist[v]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <list> | |
| using namespace std; | |
| #define NUM_V 4 | |
| bool helper(list<int>* graph, int u, bool* visited, bool* recStack) | |
| { | |
| visited[u] = true; | |
| recStack[u] = true; | |
| list<int>::iterator i; | |
| for (i = graph[u].begin(); i != graph[u].end(); ++i) |