Skip to content

Instantly share code, notes, and snippets.

View amodig's full-sized avatar

Arttu Modig amodig

View GitHub Profile
@amodig
amodig / postgres_upsert.py
Created March 9, 2022 10:33
Postgres upsert template
from jinja2 import Template
_POSTGRES_UPSERT_TEMPLATE = Template(
"""
--beginsql
INSERT INTO {{ target_table }}
{{ select_statement }}
ON CONFLICT ({{ primary_keys|join(', ') }}) DO UPDATE SET
{%- for col in target_cols %}
@amodig
amodig / Dockerfile
Created February 1, 2018 16:04
docker-airflow
FROM debian:9
MAINTAINER Arttu Modig <arttu.modig@gmail.com>
# Never prompts the user for choices on installation/configuration of packages
ENV DEBIAN_FRONTEND noninteractive
ENV TERM linux
ENV LANGUAGE en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
@amodig
amodig / quantumsiege_notes.adoc
Last active December 15, 2017 07:19
Quantum Siege (first public beta) notes

Quantum Siege Notes

Glossary
  • (DA) denotes things that could be possible to analyze with data (without user tests).

  • (A/B) denotes things that could need an A/B test to verify

The Good Things

  • Excellent graphics with a good framerate.

  • Interesting setting (pretty crazy steampunk-scifi-fantasy-mash-up?)

OPTBD2909 L'eclisse [Blu-ray]
BFIB1064 Bronco Bullfrog (Blu-Ray and DVD)
BFIB1134 Red Desert (Blu-Ray & DVD)
BFIB1145 You're Human Like The Rest Of Them (Blu-Ray+DVD)
EKA70211 The Last Command (1928) [Masters of Cinema] (Blu-ray & DVD)
BFIB1184 Schalcken the Painter (Dual Format Edition) (DVD & Blu-ray)
BFIB1123 Little Malcolm and His Struggle Against the Eunuchs (DVD + Blu-ray)
BFIB1106 Man of Violence (DVD & Blu-Ray)
BFIB1104 Herostratus - Dual Format Edition (Blu Ray & DVD)
BFIB1101 The Bed Sitting Room (DVD & Blu-Ray)
@amodig
amodig / seq_interface.js
Created April 18, 2016 11:11
JS sequence interface with inheritance example
function ArraySeq(array) {
this.array = array;
}
ArraySeq.prototype.current = function() {
return this.array[0];
}
ArraySeq.prototype.remaining = function() {
if (this.array[1]) {
return new ArraySeq(this.array.slice([1]));
}
@amodig
amodig / vector.js
Created April 14, 2016 12:34
Javascript Vector constructor
function Vector(x, y) {
this.x = x;
this.y = y;
}
Vector.prototype.plus = function(vector) {
var x_new = this.x + vector.x;
var y_new = this.y + vector.y;
return new Vector(x_new, y_new);
}
@amodig
amodig / flatten.js
Created April 5, 2016 10:31
JS flatten array of arrays
var arrays = [[1, 2, 3], [4, 5], [6]];
console.log(arrays.reduce(function(a, b) {
return a.concat(b);
}));
@amodig
amodig / deep_equal.js
Created March 29, 2016 12:43
JS deep equal
function deepEqual(o1, o2) {
if (typeof(o1)=="object" && typeof(o2)=="object" && o1 != null && o2 != null) {
for (var prop in o1) {
if (o1[prop] && o2[prop]) {
if (!deepEqual(o1[prop], o2[prop])) {
return false;
}
}
}
return true;
@amodig
amodig / gist:58ac9af3b3cf27f90db4
Created April 1, 2015 13:40
Irssi UTF-8 settings
term_charset = UTF-8
recode = ON
recode_out_default_charset = UTF-8
recode_autodetect_utf8 = ON
recode_fallback = CP1252
recode_out_default_charset = UTF-8
recode_transliterate = ON
@amodig
amodig / output
Last active August 29, 2015 14:07
Verbose Makefile error
$ make mex
gcc-4.7 -v -O3 -fPIC -pthread -Wall -Werror -ansi -ffast-math -fomit-frame-pointer -I \
-I/home/amodig/MATLAB/R2014a/extern/include -o matlabscalar.o -c matlabscalar.cpp
Using built-in specs.
COLLECT_GCC=gcc-4.7
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.7.3-2ubuntu1~12.04' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64