Skip to content

Instantly share code, notes, and snippets.

View halirutan's full-sized avatar

Patrick Scheibe halirutan

  • Neurophysics Dep. at Max Planck Institute for Human Cognitive and Brain Sciences
  • Leipzig, Germany
View GitHub Profile
javascript:(function(){if(window.MathJax===undefined){var%20script%20=%20document.createElement("script");script.type%20=%20"text/javascript";script.src%20=%20"https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML";var%20config%20=%20%27MathJax.Hub.Config({%27%20+%20%27extensions:%20["tex2jax.js"],%27%20+%20%27tex2jax:%20{%20inlineMath:%20[["$","$"],["\\\\\\\\\\\\(","\\\\\\\\\\\\)"]],%20displayMath:%20[["$$","$$"],["\\\\[","\\\\]"]],%20processEscapes:%20true%20},%27%20+%20%27jax:%20["input/TeX","output/HTML-CSS"]%27%20+%20%27});%27%20+%20%27MathJax.Hub.Startup.onload();%27;if%20(window.opera)%20{script.innerHTML%20=%20config}%20else%20{script.text%20=%20config}%20document.getElementsByTagName("head")[0].appendChild(script);(doChatJax=function(){window.setTimeout(doChatJax,1000);MathJax.Hub.Queue(["Typeset",MathJax.Hub]);})();}else{MathJax.Hub.Queue(["Typeset",MathJax.Hub]);}})();
Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"1", "+",
"2"}]], "Input",ExpressionUUID->"1af99729-7bba-4838-8e03-17d288233302"],
Cell[BoxData["3"], \
"Output",ExpressionUUID->"67bda01c-13f0-4dbf-8242-e9fd46ff6237"]
}, Open ]]
(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 11.3' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
@halirutan
halirutan / Greetings.md
Last active July 9, 2018 16:44
StackExchange standard greeting comments

StackExchange greetings

The list below is an extended version of the answers from this post and it is meant to contain easy to copy comments for new users.

Standard greetings

Welcome to Mathematica.SE! I suggest the following:

  1. As you receive help, try to give it too, by answering questions in your area of expertise.
  2. Take the [tour] and check the faqs!
  3. When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge.
/*
* Copyright (c) 2013 Patrick Scheibe
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
@halirutan
halirutan / JuliaConnect.cpp
Created September 10, 2017 11:47
Simple way to call a Julia function throught LibraryLink
#include "WolframLibrary.h"
#include "julia.h"
DLLEXPORT mint WolframLibrary_getVersion() {
return WolframLibraryVersion;
}
DLLEXPORT int WolframLibrary_initialize(WolframLibraryData libData) {
return 0;
}
@halirutan
halirutan / JuliaSet.kt
Created September 5, 2017 01:19
Naive implementation of visualizing a julia set with Kotlin
package de.halirutan.kotlin
import java.awt.Color
import java.awt.Image
import java.awt.image.BufferedImage
import javax.swing.ImageIcon
import javax.swing.JFrame
import javax.swing.JLabel
import javax.swing.JPanel
using BenchmarkTools
function canonical(t::Vector{Int64})
n = length(t)
sortcols(cat(2,
(circshift(t,x) for x=0:(n-1))...,
(circshift(reverse(t), x) for x=0:(n-1))...
)
)[:,1]
end
@halirutan
halirutan / file-watcher.c
Created February 25, 2017 03:08
Implementation of an asynchronous file watcher with Mathematica's LibraryLink
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include "WolframLibrary.h"
#ifdef _WIN32
#include <windows.h>
void PortableSleep(int timems)
{
Sleep(timems);
/usr/local/java/jdk1.8.0_111/bin/java -ea -Xbootclasspath/a:/usr/local/IntelliJ/idea-IC-163.7743.44/lib/boot.jar -Didea.load.plugins.id=de.halirutan.mathematica -Didea.home.path=/home/patrick/.IdeaIC2016.3/system/plugins-sandbox/test -Didea.plugins.path=/home/patrick/.IdeaIC2016.3/system/plugins-sandbox/plugins -Didea.launcher.port=7533 -Didea.launcher.bin.path=/usr/local/IntelliJ/idea-IC-163.7743.44/bin -Dfile.encoding=UTF-8 -classpath /usr/local/IntelliJ/idea-IC-163.7743.44/lib/idea_rt.jar:/usr/local/IntelliJ/idea-IC-163.7743.44/plugins/junit/lib/junit-rt.jar:/usr/local/IntelliJ/idea-IC-163.7743.44/lib/bcprov-jdk15on-155.jar:/usr/local/IntelliJ/idea-IC-163.7743.44/lib/jsch.agentproxy.usocket-jna.jar:/usr/local/IntelliJ/idea-IC-163.7743.44/lib/jgoodies-common-1.2.1.jar:/usr/local/IntelliJ/idea-IC-163.7743.44/lib/kotlin-runtime.jar:/usr/local/IntelliJ/idea-IC-163.7743.44/lib/jsch.agentproxy.sshagent.jar:/usr/local/IntelliJ/idea-IC-163.7743.44/lib/extensions.jar:/usr/local/IntelliJ/idea-IC-163.7743.44/lib/java