Skip to content

Instantly share code, notes, and snippets.

View carl-parrish's full-sized avatar

Carl Parrish carl-parrish

View GitHub Profile

Copied from Computer Hope

Description

For each file, getfacl displays the file name, owner, the group, and the ACL (Access Control List). If a directory has a default ACL, getfacl also displays the default ACL. Non-directories cannot have default ACLs.

If getfacl is used on a file system that does not support ACLs, getfacl displays the access permissions defined by the traditional file mode permission bits.

The output format of getfacl is as follows:

1: # file: somedir/

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@carl-parrish
carl-parrish / maxStockProfit.md
Created December 26, 2017 03:53
Max Stock Profit
function maxStockProfit(pricesArr) {

  const Price = {
    'buy': 0,
    'sell': 0,
    'change': true
  };
  
 
@carl-parrish
carl-parrish / sieveOfEratosthenes.md
Created December 22, 2017 14:58
Sieve of Eratosthenes
Array.range = (start, stop, step=1) => {
  let A = [start];
  while(start+step <= stop){
    A = [...A, start+=step];
  }
  return A;
}
@carl-parrish
carl-parrish / linkedList.md
Created December 18, 2017 16:31
Double Linked List
function LinkedList(head = null, tail= null) {
  this.head = head;
  this.tail = (tail)? tail: head;
}

function ListNode(val, next=null, previous=null) {
  this.val = val;
  this.next = next;
  this.previous = previous;
@carl-parrish
carl-parrish / addTwoNumbers.md
Created December 11, 2017 19:48
Add Two Linked List.

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.

You may assume the two numbers do not contain any leading zero, except the number 0 itself.

/**
 * Definition for singly-linked list.
 * function ListNode(val) {
@carl-parrish
carl-parrish / twoSum.md
Created December 11, 2017 12:45
Two Sum
function twoSum(arr, target) {
  return arr.reduce((pairs, val, indx, srcArr) => {
    let remainder = target - val;
    let indx2 = srcArr.indexOf(remainder);
    return indx2 !== -1 ? [...pairs, [val, remainder]] : pairs;
  }, []);
}

const numArray = [1, 6, 4, 5, 3, 3];
@carl-parrish
carl-parrish / caesarCipher.md
Created December 9, 2017 01:55
Caesar Cipher
function caesarCipher(str, num) {
  [...arr] = str.toLowerCase();
  return arr.map((val,indx,input)=> {
    if (val.match(/[^a-z]/gi)) return val.charCodeAt(0);
    let code = input.join('').charCodeAt(indx) + num;
    return ( 96 < code && code < 123) ? code : 
    				(code >= 123) ? code - 26 : code + 26;
  });
 
@carl-parrish
carl-parrish / sentenceReverse.md
Last active December 25, 2017 15:34
Interview Questions.

Sentence Reverse

You are given an array of characters arr that consists of sequences of characters separated by space characters. Each space-delimited sequence of characters defines a word.

Implement a function reverseWords that reverses the order of the words in the array in the most efficient manner.

Explain your solution and analyze its time and space complexities.

Example:

@carl-parrish
carl-parrish / flattenMap.md
Last active December 25, 2017 16:14
FlattenArray.js
/********************
** Write some code, that will flatten an array 
** of arbitrarily nested arrays of integers 
** into a flat array of integers. 
** e.g. [[1,2,[3]],4] -> [1,2,3,4]
************************/

var answer = [];