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 | |
# ./valgrind-helper.sh my-log.txt my-program | |
# ./valgrind-helper.sh my-program | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
YELLOW='\033[0;33m' | |
NC='\033[0m' # No Color | |
SEPARATOR="${YELLOW}========================================${NC}" |
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
Introduction | |
Navigation | |
Expressions | |
Text formatting | |
Notes and comments | |
Conditionals (if) | |
Return (return) | |
Multiple outcome decisions (switch/match) | |
Traditional switch conditionals (switch) | |
Goto and jump loops (goto/loop) |
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 <set> | |
#include <utility> | |
#include <vector> | |
#include <iostream> | |
using vpii = std::vector<std::pair<int, int>>; | |
std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>> twos_difference(const std::vector<int, std::allocator<int>> &v) | |
{ | |
std::set<int, std::less<int>, std::allocator<int>> s = std::set<int, std::less<int>, std::allocator<int>>(v.begin(), v.end()); |
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> | |
#include <array> | |
#include <utility> | |
#include <vector> | |
using ll = long long; | |
using pll = std::pair<ll, ll>; | |
const int maxN = 3005; | |
struct Line { |
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> | |
#include <numeric> | |
#include <vector> | |
class Predecessor { | |
protected: | |
int value; | |
public: | |
inline Predecessor(int val) : value{val} {} |
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
$PSVersionTable.PSVersion.ToString() # "5.1" | |
# You can also just use $PSVersionTable.PSVersion or simply $PSVersionTable |
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
Invoke-RestMethod -Uri 'http://ipinfo.io/ip' |
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 <stdio.h> | |
EXEC SQL define FNAME_LEN 15; | |
EXEC SQL define LNAME_LEN 15; | |
int main() { | |
EXEC SQL BEGIN DECLARE SECTION; | |
char fname[FNAME_LEN + 1]; | |
char lname[LNAME_LEN + 1]; | |
EXEC SQL END DECLARE SECTION; |
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 Range: | |
def __init__(self, start, stop=None, step=1, /): | |
if stop is None: | |
start, stop = 0, start | |
self.start, self.stop, self.step = start, stop, step | |
if step < 0: | |
lo, hi, step = stop, start, -step | |
else: | |
lo, hi = start, stop | |
self.length = 0 if lo > hi else ((hi - lo - 1) // step) + 1 |
NewerOlder