Skip to content

Instantly share code, notes, and snippets.

View marcinlawnik's full-sized avatar

Marcin Ławniczak marcinlawnik

View GitHub Profile
@marcinlawnik
marcinlawnik / qimg_image_conv.cpp
Created May 21, 2017 15:22 — forked from pelsedyr/qimg_image_conv.cpp
Conversion between QImage and Magick::Image. Tested and reliable.
Image* MainWindow::toImage(QImage* qimage)
{
qDebug() << "toImage:" << qimage->width() << qimage->height();
Image *newImage = new Image(Magick::Geometry(qimage->width(), qimage->height()), Magick::ColorRGB(0.5, 0.2, 0.3));
double scale = 1 / 256.0;
newImage->modifyImage();
Magick::PixelPacket *pixels;
Magick::ColorRGB mgc;
#!/usr/bin/env python
# based on http://stackoverflow.com/questions/7052947/split-95mb-json-array-into-smaller-chunks
# usage: python json-split filename.json
# produces multiple filename_0.json of 1.49 MB size
import json
import sys
with open(sys.argv[1],'r') as infile:
o = json.load(infile)
/****************
* drones101.js *
****************
*
* Do you remember, my dear Professor, a certain introductory
* computational rationality class you taught long ago? Assignment
* #2, behavior functions of autonomous agents? I remember that one
* fondly - but attack drones are so much easier to reason about
* when they're not staring you in the face, I would imagine!