Skip to content

Instantly share code, notes, and snippets.

View jkseppan's full-sized avatar

Jouni K. Seppänen jkseppan

View GitHub Profile
name = 'test0'
name = 'input'
lines = list(open(name).read().splitlines())
data = [line.split() for line in lines]
data = [(a, [int(x) for x in b.split(',')]) for (a,b) in data]
def unfold(data):
return [('?'.join([a]*5), b+b+b+b+b) for (a,b) in data]
def place_centermost(string, runs):

Helsingin vaalipiiri: 26

  • 12 Necada, Marek, tekniikan tohtori, fyysikko, Helsinki
  • 27 Itkonen, Juha, yrittäjä, valtiotieteiden tohtori, Helsinki
  • 31 Kivinen, Mari, erikoistutkija, filosofian tohtori, Helsinki
  • 36 Mähönen, Jukka, osuuskuntaoikeuden professori, oikeustieteen tohtori, Oslo, Norja
  • 41 Sneitz, Nina, tutkija, filosofian tohtori, Helsingfors
  • 42 Tiainen, Tuomas, tutkijatohtori, Helsinki
  • 48 Korhonen, Janne, maatalous- ja metsätieteiden tohtori, tutkija, Helsinki
  • 50 Pennanen, Petrus, filosofian tohtori, puolueen puheenjohtaja, Helsinki
# Magic constants derived from the ALU code
As = [12,10,10,-6,11,-12,11,12,12,-2,-5,-4,-4,-12]
Bs = [ 6, 2,13, 8,13, 8, 3,11,10, 8,14, 6, 8, 2]
Cs = [ 1, 1, 1,26, 1, 26, 1, 1, 1,26,26,26,26, 26]
# to get these, I split the input by "inp w" lines
# and diffed the blocks: the A is the varying x addend,
# the B the varying y addend and the C the varying z divisor
# (apparently always 1 or 26 depending on the sign of A)
import itertools as it
import numpy as np
def cube24(points):
points = np.asarray(points)
pp = [(0, 1, 2), (1, 2, 0), (2, 0, 1)]
sp = [(1, 1, 1), (-1, -1, 1), (-1, 1, -1), (1, -1, -1)]
pn = [(0, 2, 1), (1, 0, 2), (2, 1, 0)]
sn = [(-1, 1, 1), (1, -1, 1), (1, 1, -1), (-1, -1, -1)]
for perm, sign in it.chain(it.product(pp, sp), it.product(pn,sn)):
from collections import defaultdict, namedtuple
import numpy as np
def visible_cap_central_angle(altitude):
earth_radius = 6371.0
return np.arctan2(np.sqrt(altitude * (altitude + 2 * earth_radius)),
earth_radius)
def hav(x):
return np.sin(x/2)**2
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
diff --git a/DebugImageView.h b/DebugImageView.h
index 1d95cfb..d73ba70 100644
--- a/DebugImageView.h
+++ b/DebugImageView.h
@@ -21,7 +21,9 @@
#include "AutoRemovingFile.h"
#include <QStackedWidget>
+#ifndef Q_MOC_RUN
#include <boost/intrusive/list.hpp>
diff --git a/DebugImageView.h b/DebugImageView.h
index ad15d5f..921e012 100644
--- a/DebugImageView.h
+++ b/DebugImageView.h
@@ -22,8 +22,12 @@
#include "AutoRemovingFile.h"
#include <QStackedWidget>
#include <QWidget>
+#ifndef Q_MOC_RUN
#include <boost/intrusive/list.hpp>
diff --git a/MainWindow.cpp b/MainWindow.cpp
index 4b383cc..f5ebe58 100644
--- a/MainWindow.cpp
+++ b/MainWindow.cpp
@@ -1979,10 +1979,11 @@ MainWindow::showInsertFileDialog(BeforeOrAfter before_or_after, ImageId const& e
QFileInfo const file_info(files[i]);
ImageFileInfo image_file_info(file_info, std::vector<ImageMetadata>());
- ImageMetadataLoader::Status const status = ImageMetadataLoader::load(
- files.at(i), bind(&std::vector<ImageMetadata>::push_back,