This file contains hidden or 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> | |
#include <string> | |
#include <unordered_map> | |
#include <algorithm> | |
#include <vector> | |
#include <ctype.h> | |
using namespace std; | |
This file contains hidden or 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> | |
#include <sstream> | |
#include <regex> | |
#include <string> | |
#include <unordered_map> | |
#include <vector> | |
using namespace std; | |
This file contains hidden or 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
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"); |
This file contains hidden or 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
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) |
This file contains hidden or 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
# --- 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\]" |
This file contains hidden or 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
# 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" |
NewerOlder