Skip to content

Instantly share code, notes, and snippets.

View abatilo's full-sized avatar

Aaron Batilo abatilo

View GitHub Profile
@abatilo
abatilo / static_test.cpp
Created October 26, 2015 14:50
static initialization test
#include <stdio.h>
class Temp {
public:
static int a;
};
int main() {
printf("a: %d\n", Temp::a);
return 0;
#include <stdio.h>
class Temp {
public:
static int a;
};
int Temp::a = 0;
@abatilo
abatilo / fizz.py
Created October 28, 2015 16:37
3 line implementation of fizz buzz using pythonic one liners
for i in range(1, 101):
s = "%s%s" % ('Fizz' if i % 3 == 0 else '', 'Buzz' if i % 5 == 0 else '')
print s if len(s) > 0 else i
@abatilo
abatilo / prime.cs
Created November 4, 2015 01:13
4Francesca
using System;
public class Test
{
private static bool IsPrime(int num)
{
if (num == 0 || num == 1) return false;
if (num == 2) return true;
for (int i = 2; i < num; ++i) {
@abatilo
abatilo / vector_sample.cpp
Created November 17, 2015 17:25
C++ sample of using a vector with auto for an iterator
#include <iostream>
#include <vector>
int main() {
std::vector<int> v {1, 2, 3};
for (auto& i : v) {
std::cout << i;
}
std::cout << std::endl;
return 0;
#include <iostream>
using namespace std;
int main() {
float a = 999999999999999999;
float b = 1000000000000000000;
cout << (a == b) << endl;
return 0;
}
@abatilo
abatilo / t.c
Created January 15, 2016 07:12
#include <stdio.h>
typedef struct {
double t;
} temp;
int main() {
temp a, b;
a.t = 999999999999999999;
b.t = 1000000000000000000;
#include <stdio.h>
#include <stdbool.h>
int main() {
const char *A = "powerful";
const int sizeA = 8;
const char *B = "fulewopr";
const int sizeB = 8;
int lettersA[26];
from random import randint
size = 7
# 1 - 9 just so that monospace fonts look nice
min_dist = 1
max_dist = 9
with open('out.inp', 'w') as f:
f.write(str(size) + '\n')
for i in xrange(size):
#include <iostream>
#include <stack>
#include <string>
#include <queue>
#include <vector>
using namespace std;
bool is_valid_parens(const string &parens) {
stack<char> s;
for (size_t i = 0; i < parens.length(); ++i) {