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
//Const Quick-Ref | |
int variable_integer = 39; | |
const int constant_integer = 42; | |
const int * var_ptr_to_const_int = &constant_integer; | |
int const * also_var_ptr_to_const_int = &constant_integer; | |
int * const const_ptr_to_var_int = &variable_integer; | |
int const * const const_ptr_to_const_int = &constant_integer; | |
int & ref_to_int = variable_integer; | |
const int & ref_to_const_int = constant_integer; |
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 <fstream> | |
using namespace std; | |
int main(void) { | |
fstream foo1; | |
foo1.open("seek.bin", ios_base::in | ios_base::out | ios_base::binary | ios_base::trunc); | |
int i; | |
for(i = -100; i < 99; i ++) { |
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> | |
using namespace std; | |
void printy(char* t) { | |
unsigned long* v; // Swab on a little-endian machine | |
v = (unsigned long*) t; | |
cout << "0x" << hex << *v << "; // " << t << endl; | |
} | |
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 <openssl/rand.h> | |
#include <stdio.h> | |
int main(void) { | |
unsigned char c; | |
int i; | |
for(i = 0; i < 100; i++) { | |
RAND_pseudo_bytes(&c, 1); | |
printf("Trial %d: %hhu %hhu\n", i, c, (c < 24 ? ~c : 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
sub score { | |
return length($_[0]) > 8 ? 8 - length($_[0]) : length($_[0]); | |
} | |
my @s; | |
for my $o (`iconv -l`) { | |
chomp $o; | |
my(@aliases) = map(uc, split(/ /, $o)); | |
tr/A-Z0-9//cd for @aliases; | |
print((sort { score($b) <=> score($a) } @aliases)[0] . ": $o\n"); |
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 <vector> | |
#include <cstring> | |
#include <iostream> | |
using namespace std; | |
struct f { | |
char x[16]; | |
}; | |
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 <fstream> | |
#include <iostream> | |
using namespace std; | |
void test(ios_base::openmode bits, char* name) { | |
fstream f; | |
f.open(name, bits); | |
cout << "Tried " << name; | |
if(f.is_open()) { |
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
<object data="star.svg" type="image/svg+xml" id="svg" width="450" height="350"> | |
<img src="star.png" alt="Star"> | |
</object> |
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 <map> | |
using namespace std; | |
int main(void) { | |
multimap<int, int> mm; | |
for(int i = 20; i; i--) | |
mm.insert(make_pair((i * 3) & 7 + i, (i * 5) & 7)); | |
multimap<int, int>::iterator it = mm.begin(); |
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> | |
using namespace std; | |
int main(void) { | |
if(false < true) | |
cout << "False is less than true." << endl; | |
if(false > true) | |
cout << "False is greater than true." << endl; | |
if(true < false) |
OlderNewer