This file contains 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
package com.polarbirds.debug; | |
/** | |
* No licence; public domain. | |
* @author krissrex | |
*/ | |
public class DebugPrint { | |
/** | |
* For testing |
This file contains 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
b = [39, 39, 38, 35,20,9] | |
ind = 0 | |
day = 1 | |
while True: | |
day += 1 | |
for i in range(ind): | |
b[i] -= 1 | |
if ind < len(b): | |
ind += 1 |
This file contains 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
def longestSeqLen(array): | |
return len(max("".join(str(i) for i in array).split("0"), key=lambda x: len(x))) | |
def longest_seq_index_and_len(array): | |
longest = max("".join(str(i) for i in array).split("0"), key=lambda x: len(x)) | |
return ("".join(str(i) for i in array)).find(longest), len(longest) | |
def readble_version(array): | |
# [1,0,0,1,1] -> ['1', '0', '0', '1', '1'] |
This file contains 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 random | |
def rand(n): | |
a = list(range(n+1)) | |
b = [] | |
while len(a): | |
i = random.randint(0, len(a)-1) | |
b.append(a[i]) | |
del a[i] | |
return b |
This file contains 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
z/x for octave down/up. q to quit. | |
Notes from c to h: | |
cCdDefFgGaAh | |
and 0 means pause. | |
Enter notes (note[duration]): | |
cdefg2g2aaaag4ffffe2e2ddddc4q | |
Parsing: c | |
Note: freq:261 duration:1 octave:4 | |
Parsing: d |
This file contains 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
package tdt4100.encapsulation.util; | |
import java.io.BufferedReader; | |
import java.io.FileNotFoundException; | |
import java.io.FileReader; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; |
This file contains 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 os, shutil | |
def list_files(): | |
files = [f for f in os.listdir('.') if os.path.isfile(f) and f.endswith('.png')] | |
print(files) | |
return files | |
def find_out(): | |
out_folder = 'out' | |
counter = 0; |
This file contains 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
package com.polarbirds.rxjavaexperiments; | |
import javafx.application.Application; | |
import javafx.fxml.FXMLLoader; | |
import javafx.scene.Parent; | |
import javafx.scene.Scene; | |
import javafx.stage.Stage; | |
public class Main extends Application { |
This file contains 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
def read(path): | |
with open(path) as f: | |
return "".join(f.readlines()) | |
def tokenize(str): | |
out = [] | |
str = str.strip() | |
str = str.strip("{").strip("}") | |
str = str.split(",\n") | |
for kv in str: |
This file contains 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 "Blackjack.h" | |
#include <algorithm> // min | |
#include <iostream> | |
// Unnamed namespace for liten util-function i 5d | |
namespace { | |
int askForAceValue() | |
{ | |
int value = -1; | |
while (!(value == 1 || value == 11)) |
OlderNewer