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
# The following should be in `/etc/sudoers`. To edit `/etc/suoders` use the command `sudo visudo` in a terminal. | |
# *Do NOT attempt to modify the file directly* | |
Defaults env_reset | |
Defaults mail_badpass | |
Defaults env_keep+="http_proxy ftp_proxy all_proxy https_proxy no_proxy" # Add this line | |
... |
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 <cstddef> | |
#include <vector> | |
template <typename T> | |
class Array2D | |
{ | |
public: | |
Array2D() | |
: height_(0), width_(0) | |
{} |
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
template <class FwdIt> | |
FwdIt Merge( | |
FwdIt first1, FwdIt last1, | |
FwdIt first2, FwdIt last2, | |
FwdIt result | |
) | |
{ | |
while (true) | |
{ | |
if (*first2 < *first1) |
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
void AllPrimesTill(int32_t till, std::vector<int32_t>& primes) | |
{ | |
BitSet<true> isPrime(till + 1); | |
isPrime.Reset(0); | |
isPrime.Reset(1); | |
int32_t cap = static_cast<int32_t>( std::sqrt(till) ) + 1; | |
primes.clear(); | |
for (int32_t i = 2; i <= cap; ++i) |
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
template <bool defaultState = false> | |
class BitSet | |
{ | |
public: | |
BitSet(std::size_t size) | |
: size_(size), bits_((size_ + 7) / 8, defaultState ? 0xff : 0x0) | |
{ | |
// Masks for each bit. Example, | |
// | |
// 7 6 5 4 3 2 1 0 |
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
[credential] | |
helper = cache --timeout=7200 | |
[merge] | |
tool = meld | |
[diff] | |
tool = meld | |
[alias] | |
st = status | |
ci = commit | |
br = branch |
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 <string> | |
int main(int argc, char* argv[]) | |
{ | |
string name; | |
std::cin >> name; | |
std::cout << "Hello " << name << "!" << std::endl; | |
return 0; |
NewerOlder