Skip to content

Instantly share code, notes, and snippets.

View bernikr's full-sized avatar

Bernie bernikr

View GitHub Profile
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
import math
def phi(n):
k = 0
for i in range(1,n,2):
if math.gcd(n,i)==1:
k += 1
return k
i=0
gems:
- jekyll-coffeescript
// ==UserScript==
// @name Aurora Lock Reviews
// @version 0.1
// @description Verhindert das versehentliche Verschieben von Text-Teilen in fertigen reviews
// @author bernikr
// @match https://aurora.iguw.tuwien.ac.at/*
// ==/UserScript==
(function() {
'use strict';
// ==UserScript==
// @name Aurora Chat experiments
// @version 0.11
// @description private
// @author bernikr
// @match https://aurora.iguw.tuwien.ac.at/*
// ==/UserScript==
(function() {
'use strict';
@bernikr
bernikr / pairs.r
Last active December 27, 2017 14:57
pairsGame <- function(cards, maxTries){
unknown_fields <- sample(c(1:cards, 1:cards), 2*cards, replace=FALSE)
known_fields <- c()
won_pairs <- c()
playRound <- function(){
# check if we already know a pair
if(anyDuplicated(known_fields) != 0){
# Open both Card of the pair
card <- known_fields[duplicated(known_fields)]
*.csv
*.pyc
.Rhistory
.RData

Keybase proof

I hereby claim:

  • I am bernikr on github.
  • I am bernikr (https://keybase.io/bernikr) on keybase.
  • I have a public key ASC3dGW0CzsThXIAdluQxDRMQ46ShqHLzWAhwRQb00azhwo

To claim this, I am signing this object:

import json
import operator
from datetime import datetime, timedelta
import iso8601 as iso8601
import pytz as pytz
from collections import defaultdict
if __name__ == '__main__':
with open('result.json', encoding="utf-8") as f:
data = json.load(f)
import bisect
import random
from itertools import accumulate
def towers(inp, n):
accumulated_height = [0] + [i for i in accumulate(inp)]
average_tower_height = accumulated_height[-1]//n
tows = []