Skip to content

Instantly share code, notes, and snippets.

@lshifr
lshifr / lincomp.c
Last active December 14, 2015 20:19
LinearComplexity
# include <stdio.h>
# include <stdlib.h>
# include <time.h>
int random_in_range (unsigned int min, unsigned int max)
{
int range = max - min,
remainder = RAND_MAX % range,
bucket = RAND_MAX / range;
@lshifr
lshifr / EntireTableReader.m
Last active December 14, 2015 14:58
Java code for Mathematica to read entire file of floats
JCompileLoad@"
import java.io.*;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.FileChannel.MapMode;
import java.util.Arrays;
public class EntireTableReader{
public static float[] getFloatTable(String filename, int rowByteCount, int rowChunkSize)
@lshifr
lshifr / SimpleOO.m
Last active December 10, 2015 01:58
The most simple basic core of the OO extension to Mathematica.
(* Mathematica Package *)
BeginPackage["SimpleOO`"]
(* Exported symbols added here with SymbolName::usage *)
Object;
@lshifr
lshifr / RawVCS.m
Created December 19, 2012 02:42
Simple version control system for Mathematica projects hosted on Github via Github gists
(* Mathematica Package *)
BeginPackage["RawVCS`", { "RuleTreeInfo`", "GithubGistClient`", "FileInfo`", "GithubGistProjectInfo`", "OO`", "OO`Methods`", "OO`Errors`"}]
(* Exported symbols added here with SymbolName::usage *)
RawVCS;
Begin["`Private`"] (* Begin Private Context *)
@lshifr
lshifr / GithubGistProjectInfo.m
Created December 18, 2012 16:59
An object to manage project.m files for Github gist-based Mathematica projects
(* Mathematica Package *)
BeginPackage["GithubGistProjectInfo`", { "RuleTreeInfo`", "OO`", "OO`Methods`", "OO`Errors`"}]
(* Exported symbols added here with SymbolName::usage *)
GithubGistProjectInfo;
Begin["`Private`"] (* Begin Private Context *)
join = Function[{dir, file}, FileNameJoin[{dir, file}]];
@lshifr
lshifr / FileInfo.m
Created December 15, 2012 20:10
A data type to simplify in-memory operations with project's files (and generally files in a directory)
(* Mathematica Package *)
BeginPackage["FileInfo`", {"OO`","OO`Methods`","OO`Errors`", "RuleTreeInfo`"}]
(* Exported symbols added here with SymbolName::usage *)
FileInfo;
Begin["`Private`"] (* Begin Private Context *)
join = Function[{dir, file}, FileNameJoin[{dir, file}]];
@lshifr
lshifr / PackageManipulations.m
Created December 12, 2012 11:53
A Mathematica package for run-time manipulations with Mathematica packages
(* ::Package:: *)
(*......................................................................*)
(* :Title: PackageManipulations *)
(* :Author: Leonid B.Shifrin *)
@lshifr
lshifr / GithubGistClient.m
Created December 12, 2012 11:23
A Mathematica client for Github gists
(* Mathematica Package *)
BeginPackage["GithubGistClient`"]
(* Exported symbols added here with SymbolName::usage *)
(* TODO:
1. Make this OO
2. Get rid of curl
@lshifr
lshifr / RuleTreeInfo.m
Created December 12, 2012 09:59
A generic object implementing operations on trees of rules for Mathematica
(* Mathematica Package *)
BeginPackage["RuleTreeInfo`", { "OO`"}]
(* Exported symbols added here with SymbolName::usage *)
RuleTreeInfo;
Begin["`Private`"] (* Begin Private Context *)
@lshifr
lshifr / LICENSE
Created December 12, 2012 08:35
Simple object-oriented extension for Mathematica
Copyright (c) 2012 Leonid Shifrin
This project is licensed under the MIT license,
http://opensource.org/licenses/MIT
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