Skip to content

Instantly share code, notes, and snippets.

View loitpham's full-sized avatar

Loi Pham loitpham

View GitHub Profile
find . -maxdepth 1 -type d | grep -i Native
Set<String> set = saved.getAll().keySet();
String[] mystring = set.toArray(new String[0]);
With recursion
find . -type d | grep -i <search-term>
Without recursion
find . -type d -maxdepth 1 | grep -i <search-term>
// Tags: Arithmetic Slices, Dynamic Programming
/**
* Problem:
* A sequence of numbers is called arithmetic if it consists of at least
* three elements and if the difference between any two consecutive elements
* is the same.
*
* For example, these are arithmetic sequences:
*
// Tags: anagram, hash map
import java.util.HashMap;
import java.util.Map;
/**
* Problem:
* Given two strings s and t , write a function to determine if t is an
* anagram of s.
*
// Tags: recursion, bit manipulation, reduce to zero
/**
* Problem:
* Given a non-negative integer num, return the number of steps to reduce it
* to zero. If the current number is even, you have to divide it by 2,
* otherwise, you have to subtract 1 from it.
*
* Example 1:
*
// Tags: Stack, Absolute Path, Canonical Path
/**
* Problem:
* Given a string path, which is an absolute path (starting with a slash '/')
* to a file or directory in a Unix-style file system, convert it to the
* simplified canonical path.
*
* In a Unix-style file system, a period '.' refers to the current directory,
* a double period '..' refers to the directory up a level, and any multiple
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools),
missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
First fix: Reinstall Xcode toolkit
`$ xcode-select --install`
Second fix: Reset
`$ sudo xcode-select --reset`
1. Create `KeyBindings` folder in `~/Library`
2. Create a `DefaultKeyBinding.dict` file and store it the `KeyBindings` with the following contents:
{
"\UF729" = moveToBeginningOfParagraph:; // home
"\UF72B" = moveToEndOfParagraph:; // end
"$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
"$\UF72B" = moveToEndOfParagraphAndModifySelection:; // shift-end
"^\UF729" = moveToBeginningOfDocument:; // ctrl-home
"^\UF72B" = moveToEndOfDocument:; // ctrl-end
## In terminal:
`brew install pygments`
## In TexStudio Preferences
Add `-shell-escape` flag to the `pdflatex` line
`"pdflatex" -synctex=1 -shell-escape -interaction=nonstopmode %.tex`
## If /usr/local/bin/pygmentize exists, delete it
`sudo rm -rf /usr/local/bin/pygmentize`