Skip to content

Instantly share code, notes, and snippets.

Leonid Shifrin lshifr

Block or report user

Report or block lshifr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
lshifr / FrozenCode.m
Created May 19, 2016
A non-standard evaluator for Mathematica code, allowing to evaluate the code in the "frozen" mode
View FrozenCode.m
FrozenCodeEvaluate::usage = "FrozenCodeEvaluate[Hold[code], {heads}] evaluates the code
in the 'frozen' mode, where only specific heads are allowed to evaluate";
SetAttributes[symbolToHideQ, HoldFirst];
symbolToHideQ[s_Symbol, expandedSymbs_] :=! MemberQ[expandedSymbs, Unevaluated[s]];
lshifr / SmartLet.m
Created Nov 7, 2014
Smart Let in Mathematica
View SmartLet.m
ClearAll[Let, let, symbolOrListQ, inSetDelayed];
SetAttributes[{Let, let, symbolOrListQ}, HoldAll];
symbolOrListQ[_Symbol] = True;
symbolOrListQ[{___?symbolOrListQ}] = True;
symbolOrListQ[_] = False;
Let::lvset = "Local variable specification `1` is not valid.";
lshifr / ReferenceTracker.m
Created Apr 29, 2016
A Mathematica package to track which symbols may reference a given symbol
View ReferenceTracker.m
$globalProperties = {
lshifr / Defines.m
Last active Mar 18, 2016
Static code analyzer for Mathematica code
View Defines.m
SetAttributes[shead, HoldAllComplete];
shead[f_Symbol[___]] := HoldComplete[f];
shead[f_[___]] := shead[f];
shead[f_ /; AtomQ[Unevaluated[f]]] := Head[f];
(* TODO:This is a bit too simplisitc,since some pattern symbols might \
be localized by inner rules inside expr,and should not be \
counted.We might miss some extra dependencies this way *)
lshifr / HTMLParser.m
Last active Mar 9, 2016
A very simplistic breadth - first HTML parser in Wolfram Mathematica
View HTMLParser.m
ParseHTML::usage = "ParseHTML[s] parses a string of HTML code";
HTMLContainer::usage = "HTMLContainer[tag] is an inert container for the contents of html tag";
lshifr / SEFormatter.m
Last active Dec 18, 2015
Code formatter palette for
View SEFormatter.m
(* Mathematica Package *)
(* :Title: SEFormatter *)
(* :Author: Leonid B. Shifrin *)
(* :Summary: Code formatting palette for
(but can be useful also for other formatting purposes) *)
(* :Context: SEFormatter` *)
lshifr / lincomp.c
Last active Dec 14, 2015
View lincomp.c
# 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 / EntireTableReader.m
Last active Dec 14, 2015
Java code for Mathematica to read entire file of floats
View EntireTableReader.m
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 / SimpleOO.m
Last active Dec 10, 2015
The most simple basic core of the OO extension to Mathematica.
View SimpleOO.m
(* Mathematica Package *)
(* Exported symbols added here with SymbolName::usage *)
lshifr / RawVCS.m
Created Dec 19, 2012
Simple version control system for Mathematica projects hosted on Github via Github gists
View RawVCS.m
(* Mathematica Package *)
BeginPackage["RawVCS`", { "RuleTreeInfo`", "GithubGistClient`", "FileInfo`", "GithubGistProjectInfo`", "OO`", "OO`Methods`", "OO`Errors`"}]
(* Exported symbols added here with SymbolName::usage *)
Begin["`Private`"] (* Begin Private Context *)
You can’t perform that action at this time.