This file contains 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
class PythonAT2 < Formula | |
desc "Interpreted, interactive, object-oriented programming language" | |
homepage "https://www.python.org/" | |
url "https://www.python.org/ftp/python/2.7.17/Python-2.7.17.tar.xz" | |
sha256 "4d43f033cdbd0aa7b7023c81b0e986fd11e653b5248dac9144d508f11812ba41" | |
revision 1 | |
head "https://github.com/python/cpython.git", :branch => "2.7" | |
bottle do | |
sha256 "accfaa922708f00afb69ab230199f96e6ecdddd248a1eca586ce1e5e5cfd732b" => :catalina |
Use strict modes unless you have a good reason not to:
- Use
set -e
to abort on errors (nonzero exit code) - Use
set -o pipefail
too, to abort on errors within pipes (though read up on it more if you do, as this topic is a bit subtle). - Use
set -u
to detect unset variable usages. - Use
set -x
(or the variantset -v
, which logs raw input, including unexpanded variables and comments) for debugging output.
This file contains 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
# shortform git commands | |
alias g='git' | |
# pretty tab'd git log | |
git log --graph --pretty="tformat:%h*(%ar)*<%an>*%d %s" $* | sed -Ee 's/(^[^<]*) ago\)/\1)/' | sed -Ee 's/(^[^<]*), [[:digit:]]+ .*months?\)/\1)/' | column -s '*' -t | cat | |
# change author of all git repos | |
git filter-branch -f --env-filter "GIT_AUTHOR_NAME='yourname'; GIT_AUTHOR_EMAIL='youremail@example.com'; GIT_COMMITTER_NAME='yourname'; GIT_COMMITTER_EMAIL='youremail@example.com';" HEAD; | |
# stage only deleted files |
- http://stackoverflow.com/questions/804115 (
rebase
vsmerge
). - https://www.atlassian.com/git/tutorials/merging-vs-rebasing (
rebase
vsmerge
) - https://www.atlassian.com/git/tutorials/undoing-changes/ (
reset
vscheckout
vsrevert
) - http://stackoverflow.com/questions/2221658 (HEAD^ vs HEAD~) (See
git rev-parse
) - http://stackoverflow.com/questions/292357 (
pull
vsfetch
) - http://stackoverflow.com/questions/39651 (
stash
vsbranch
) - http://stackoverflow.com/questions/8358035 (
reset
vscheckout
vsrevert
)
This file contains 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
PROMPT='%(!..%{$fg[red]%}$USER %{$fg[yellow]%})%2~%{$fg[cyan]%}$(git_prompt_info)%{$reset_color%} %{$fg_bold[blue]%}%(!.#.$) ' | |
ZSH_THEME_GIT_PROMPT_PREFIX=" (" | |
ZSH_THEME_GIT_PROMPT_SUFFIX=")" |
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure |
---|---|---|---|---|---|---|
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array |
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List |
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array |
This file contains 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
alias g='git' | |
alias ga='git add' | |
alias gapa='git add --patch' | |
alias gb='git branch' | |
alias gbd='git branch -d' | |
alias gbD='git branch -D' | |
alias gc='git commit -v' |
This file contains 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
function secure_array(&$array) { | |
// this function secures the content of an array against SQL injection and HTML code injection attacks | |
// it works for arrays of any number of dimensions, recursively for each dimension | |
if (isset($array)) { | |
foreach ($array as $key => $value) { | |
if (is_array($array[$key])) { // if element is array, then go to next dimension | |
secure_array($array[$key]); | |
} elseif (is_string($array[$key])) { // if element is a string variable, clean it up | |
$array[$key] = $mysqli -> real_escape_string($array[$key]); // replace this with mysql / PDO real escape string function depending on which database connector you are using |