Skip to content

Instantly share code, notes, and snippets.

View gibizer's full-sized avatar

Balazs Gibizer gibizer

View GitHub Profile
#include <iostream>
#include <fstream>
#include <string>
#include <unordered_map>
#include <algorithm>
#include <vector>
#include <ctype.h>
using namespace std;
#include <iostream>
#include <fstream>
#include <sstream>
#include <regex>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
use std::collections::HashMap;
use std::fs::File;
use std::io::Read;
fn main() {
let mut counter = HashMap::new();
let mut f = File::open("sherlock.txt")
.expect("cannot open file");
import collections
import re
with open('sherlock.txt') as f:
words = re.findall(r'\w+', f.read().lower())
counter = collections.Counter(words)
for w, c in counter.most_common(20):
print(w, c)
# --- prompt ---
# based on https://gist.github.com/mkottman/1936195
RESET="\[\033[0m\]"
RED="\[\033[0;31m\]"
GREEN="\[\033[01;32m\]"
DARK_GREEN="\[\033[38;5;70m\]"
BLUE="\[\033[01;34m\]"
YELLOW="\[\033[0;33m\]"
WHITE="\[\033[0;37m\]"
# run test for each commit in a commit chain. Stop at the commit that fails the test.
# It allows editing the commit, then git commit --amend , then git rebase --continue ,
# the --continue will re-run the tests before it moves to the next commit.
# The progress of the rebase can be monitored in the file .git/rebase-merge/done
git rebase -i <rebase-target> --reschedule-failed-exec --exec "tox -e py27 && tox -e fast8"
# run test in parallel
git rebase -i <rebase-target> --reschedule-failed-exec --exec " echo 'functional py27 fast8' | tr ' ' '\n' | parallel --lb 'set -o pipefail && rtox -e {} | tee /tmp/{}.log'"
git rebase -i <rebase-target> --reschedule-failed-exec --exec "ptox functional py27 fast8"