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
// ==UserScript==
// @name Select Code Block Buttons
// @namespace stackoverflow
// @include *stackoverflow.com*
// @include *stackexchange.com*
// ==/UserScript==
(function ()
{
function with_jquery(f)
@halirutan
halirutan / ValidateMathematicaInstallation.m
Created November 22, 2016 05:34
Tries to validate a Mathematica installation and extract version and other information
ClearAll[parseRevisionFile, parseInfoPlist, findKernel,
findAddOnPackages, findJLinkJar];
validateMathematicaInstallation::err = "`` could not validate ``";
abort[f_,
arg_] := (Message[validateMathematicaInstallation::err, f, arg];
Abort[]);
parseRevisionFile[path_ /; FileExistsQ[path]] :=
With[{
@halirutan
halirutan / TestInspection.java
Last active November 24, 2016 23:30
Shows how that a ComboBox cannot ititially be set to enabled(false) in LocalInspection
/*
* Copyright (c) 2016 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
/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
@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);
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 / 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
@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;
}
/*
* 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
(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 11.3' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest