Skip to content

Instantly share code, notes, and snippets.

@sandordargo
sandordargo / ghost_in_the_shell
Last active February 28, 2017 16:32
ghost in the cell bronze top 50
import sys
from collections import defaultdict
# send to multiples from one, if can
# if closest is enemy and three or two, bomb
# zero prod could bomb
class Increase(object):
@sandordargo
sandordargo / find_first_n_elements.py
Created August 18, 2017 11:51
Get first n largest elements of a list
import random
def get_random_numbers(amount):
random_numbers = random.sample(range(1, 1000), amount)
print([x for x in reversed(sorted(random_numbers))])
return random_numbers
def get_n_largest_elements_of_list(a_list, number_of_elements_to_get):
@sandordargo
sandordargo / find_first_3_elements.py
Created August 18, 2017 11:53
Get first 3 largest elements of a list (without sorting the whole list)
import random
def get_random_numbers(amount):
random_numbers = random.sample(range(1, 1000), amount)
print([x for x in reversed(sorted(random_numbers))])
return random_numbers
numbers = get_random_numbers(100)
@sandordargo
sandordargo / gitconfig
Last active July 1, 2019 15:22
git diff & add combined
[alias]
da = "! addprev() { while true; do \
read -p \"Do you wish to add this file? ([Y]es, [N]o, [P]atch)\" yn ; \
case $yn in \
[Yy]* ) git add $1; break;; \
[Pp]* ) git add -p $1; break;; \
[Nn]* ) exit;; \
* ) echo "Please answer yes, no or patch.";; \
esac \
done } ; \
#include <iostream>
#include <vector>
#include <string>
#include <exception>
#include <numeric>
#include <functional>
#include <tuple>
#include <memory>
template <class T>
#include <iostream>
#include <vector>
#include <string>
#include <exception>
#include <numeric>
#include <functional>
#include <tuple>
#include <memory>
#include <variant>