Skip to content

Instantly share code, notes, and snippets.

View danicat's full-sized avatar

Daniela Petruzalek danicat

View GitHub Profile
@danicat
danicat / SRM_502_Div2_500.cpp
Created January 6, 2014 15:02
TopCoder SRM 502 Division 2 500 pts
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
bool compare(string a, string b) {
return a.length() < b.length();
}
@danicat
danicat / SRM_146_Div2_250.cpp
Created January 7, 2014 15:08
TopCoder SRM 146 Division 2 250 pts Since you need to calculate the sum of repeated values it seemed natural to me to use a hash table (map) to store the respective sums. Once you have that sum stored you just need to return the highest sum with a simple max algorithm.
#include <vector>
#include <map>
using namespace std;
class YahtzeeScore {
public:
int maxPoints(vector<int> toss) {
map<int, int> sum;
@danicat
danicat / SRM_146_Div2_500.cpp
Created January 7, 2014 16:19
TopCoder SRM 146 Division 2 500 pts.
class RectangularGrid {
public:
long long countRectangles(int width, int height) {
long long count = 0;
for(int w = 0; w < width; ++w) {
for(int h = 0; h < height; ++h) {
if( w == h ) continue;
count += (height-h) * (width-w);
}
@danicat
danicat / PKZIP APPNOTE 6.3.4.
Created May 26, 2016 17:46 — forked from ross-spencer/PKZIP APPNOTE 6.3.4.
Unmodified copy of PKZIP Speciffication, source date: 1 November 2015: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
File: APPNOTE.TXT - .ZIP File Format Specification
Version: 6.3.4
Status: Final - replaces version 6.3.3
Revised: October 1, 2014
Copyright (c) 1989 - 2014 PKWARE Inc., All Rights Reserved.
1.0 Introduction
---------------
1.1 Purpose
@danicat
danicat / stopwords.txt
Created August 11, 2016 18:14 — forked from alopes/stopwords.txt
Portuguese stop words
de
a
o
que
e
do
da
em
um
para
@danicat
danicat / git-commit-log-stats.md
Created September 19, 2017 17:29 — forked from eyecatchup/git-commit-log-stats.md
Some commands to get git commit log statistics for a repository on the command line.

git commit stats

Commands to get commit statistics for a Git repository from the command line -
using git log, git shortlog and friends.




@danicat
danicat / git-commit-log-stats.md
Created September 19, 2017 17:29 — forked from eyecatchup/git-commit-log-stats.md
Some commands to get git commit log statistics for a repository on the command line.

git commit stats

Commands to get commit statistics for a Git repository from the command line -
using git log, git shortlog and friends.




import os
from myapp import app
secret_key = os.environ.get('SECRET_KEY', None)
if not secret_key:
raise ValueError('You must have "SECRET_KEY" variable')
app.config['SECRET_KEY'] = secret_key
@danicat
danicat / main.go
Last active August 29, 2018 15:51
Golang Generics Exploration
package main
import (
"fmt"
)
func main() {
// One strategy is to include type info as the first 'n' parameters
fmt.Println(genericAdd("int", 1, 2))
fmt.Println(genericAdd("string", "1", "2"))
The first section should be the "context", which shall be composed minimally of: 1) a brief description of what we have today, and; 2) a brief description of what we want to achieve.
Include references to complementary material when necessary, e.g.: link to github repo, docs, etc, but please make sure the ticket description is complete, meaning one can have a reasonable estimate of the effort by the content of the ticket alone.
TO DO
=====
This is the list of things we want to do, written in a concise way (bullet points). Every item in this list must be actionable and have an acceptance criteria that covers it. e.g.:
- update foo to add bar as required field