Skip to content

Instantly share code, notes, and snippets.

@quaat
quaat / gist:4978425
Last active December 13, 2015 21:38
zip for javscript
// Examples inspired by http://learnyouahaskell.com/syntax-in-functions
var fibobj = {
0: function(){return 1},
1: function(){return 1},
undefined: function(n){return fibs(n-1) + fibs(n-2)}
}
var fibs = (function(o){
#include <iostream>
#include <vector>
#include <memory>
template <typename T, unsigned d1, unsigned d2 = 1, unsigned d3 = 1, unsigned d4 = 1>
struct TensorType
{
typedef typename T real;
static unsigned const rank = (d1 > 1 ? ( d2 > 1 ? (d3 > 1 ? (d4 > 1 ? 4 : 3) : 2) : 1) : 0);
(ns offset.core
(:use (incanter core stats charts datasets))
(:use [clojure.math.combinatorics])
(:require [clojure.string :as cstr]
[clojure.data.csv :as csv]
[clojure.java.io :as io]))
(defn- to-dec [t]
(if (= 1 (count t))
(first t)
@quaat
quaat / argparser.h
Created July 5, 2013 12:16
An argument parser for use with Qt. The parser itself stores the keywords as properties in QCoreApplication.
#ifndef ARG_PARSER_H_DEF
#define ARG_PARSER_H_DEF
#include <QCoreApplication>
#include <QString>
#include <QStringList>
// some unique keyword.
char static const *restkeyword = "unique-9c6e6236e14a43";
@quaat
quaat / gfortran.prf
Created September 3, 2013 22:13
qmake prf-file for mixed programming with fortran
isEmpty( fortran_compiler ) {
# gfortran.prf
# Adds gfortran as extra compiler to the qmake build system.
#
# This file must reside in the path of QMAKEFEATURES
#
# Thomas Hagelien
#
F90 = gfortran
@quaat
quaat / ifort.prf
Created September 9, 2013 13:44
Simple project file (no dependency support) for Intel Fortran compilers
NEWLINE = $$escape_expand(\\n\\r\\t)
!isEmpty(MODULE_DIR){
MODFLAGS += -J$$MODULE_DIR
INCLUDEPATH += $$MODULE_DIR
}
F90 = ifort
MKDIR = $$quote($(MAKEFILE))
@quaat
quaat / binsearchtest.f90
Created September 11, 2013 19:00
Generic binarySearch algorithm in Fortran 2003 (pure, recursive)
program binSearchTest
integer :: idx
real, allocatable :: v(:)
integer, allocatable :: v2(:)
interface binarySearch
procedure binarySearch_real
procedure binarySearch_int
end interface binarySearch
@quaat
quaat / .emacs
Last active October 29, 2020 12:42
My basic emacs config
;;; Code:
(add-to-list 'load-path "~/.emacs.d/lisp/")
(add-to-list 'load-path ".")
(setq c-basic-indent 2)
(setq tab-width 4)
(setq indent-tabs-mode nil)
(require 'org)
@quaat
quaat / create-gitlab-runner.sh
Last active November 18, 2021 18:03
dind gitlab-runner
#!/bin/bash
read -p "Enter runner name [my-runner]: " name
read -p "Enter registration token: " token
read -p "Enter gitlab url: " url
volume_name=gitlab-volume-$name
runner_name=gitlab-runner-$name
docker volume create $volume_name
@quaat
quaat / yml
Created October 28, 2021 14:40
language-codes
languages:
- af : Afrikaans
- af-ZA : Afrikaans (South Africa)
- ar : Arabic
- ar-AE : Arabic (U.A.E.)
- ar-BH : Arabic (Bahrain)
- ar-DZ : Arabic (Algeria)
- ar-EG : Arabic (Egypt)
- ar-IQ : Arabic (Iraq)