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
#include <iostream> | |
void f(bool b) { | |
if (b == true) { std::cout << "true\n"; } | |
if (b == false) { std::cout << "false\n"; } | |
} | |
int main() { | |
char c = 2; | |
bool * b = (bool*) &c; |
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
Random useful bash stuff: | |
1. . ^foo^bar - bash !! but replaces the first occurrence of foo with bar | |
2. !!:/gs/foo/bar - bash !! but replaces all occurrences of foo with bar | |
3. cd -4 = cd; cd; cd; cd. cd -- = cd; cd. cd - = cd; pwd (or use pushd and popd) | |
4. diff <(sort a) <(sort b) The output of sort a is pushed into a pipe which pretends to be a file for diff. This is process substitution | |
5. < foo grep bar | sort is the same as cat foo | grep bar | sort | |
6. $'\167' is the same as w - bash interprets octal! Also works with hex! | |
7. If you do echo !!:4 will echo the 4th argument of the last command. !$ is the last arg and !^ is the fist, !* is all. | |
8. !g will autocomplete to the last command run that began with g | |
9. set -o vi - enable vim bindings for bash |
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
#!/bin/bash -eux | |
# Where to truncate from | |
export HASH=my-hash | |
# Truncate history | |
git checkout --orphan temp "${HASH}" | |
git commit -m "Truncate History" | |
git rebase --onto temp "${HASH}" master | |
git branch -D temp |
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
diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt | |
index 0397dec64d..f9cce044fe 100644 | |
--- a/Documentation/githooks.txt | |
+++ b/Documentation/githooks.txt | |
@@ -758,6 +758,12 @@ and "0" meaning they were not. | |
Only one parameter should be set to "1" when the hook runs. The hook | |
running passing "1", "1" should not be possible. | |
+pre-blame | |
+~~~~~~~~~~~~~~ |