Skip to content

Instantly share code, notes, and snippets.

@himmelmaus
himmelmaus / thanos_sort.py
Created March 25, 2019 01:20
A quick implementation of the thanos sort algorithm, removing half of the array's elements at a time until the array is sorted
from random import randint
def thanos_sort(array):
while not is_sorted(array):
target_length = int(len(array)/2)
while len(array) > target_length:
del array[randint(0, len(array)-1)]
return array
def is_sorted(array):
@autarch
autarch / gist:ee1569cb22c80208ff72
Created June 28, 2015 22:34
Script to update all my .travis.yml files at once
#!/usr/bin/env perl
use strict;
use warnings;
use 5.20.0;
use feature 'postderef';
no warnings 'experimental::postderef';
use File::pushd qw( pushd );
@moritz
moritz / changelog-entries.pl
Created May 14, 2012 17:06
script to extract number of changelog entries per Rakudo release
#use Grammar::Tracer;
use v6;
grammar ChangeLog {
token TOP {
^ <entry>+ $
}
token entry {
<header>
<newsitem>*