Skip to content

Instantly share code, notes, and snippets.

View astanin's full-sized avatar

Sergey Astanin astanin

View GitHub Profile
@astanin
astanin / table2xml.ipynb
Last active March 23, 2016 15:03
xmlize(), a simple function similar to tabulate, to generate xml tables
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@astanin
astanin / nbody.ino
Last active January 4, 2016 09:29
n-body benchmark on Galileo/Arduino
/*
An implementation of the n-body benchmark for Intel Galileo (Arduino clone)
Expected output with TIME_STEPS = 50000000:
-0.169075164
-0.169059907
# time: ...
Performance of Intel Galileo vs desktop CPUs:
@astanin
astanin / ipython.el
Created September 30, 2013 09:58
ipython.el version 0.11 as taken from https://raw.github.com/ipython/ipython/master/docs/emacs/ipython.el with Version and "ends here" comments added, as required by Marmalade
;;; ipython.el --- Adds support for IPython to python-mode.el
;; Copyright (C) 2002, 2003, 2004, 2005 Alexander Schmolck
;; Author: Alexander Schmolck
;; Keywords: ipython python languages oop
;; URL: http://ipython.org
;; Compatibility: Emacs21, XEmacs21
;; Version: 0.11
;; FIXME: #$@! INPUT RING
@astanin
astanin / HasHeadFD.hs
Created July 17, 2013 15:09
Generic `head`-like functions implemented with functional dependency.
{-# LANGUAGE FunctionalDependencies, FlexibleInstances #-}
module HasHeadFD where
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as BSC
class HasHeadFD c e | c -> e where
@astanin
astanin / HasHead.hs
Last active December 19, 2015 21:19
Generalizing `head`-like functions with TypeFamilies.
{-# LANGUAGE MultiParamTypeClasses, TypeFamilies, FlexibleInstances #-}
module HasHead where
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as BSC
-- Usage example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Array abstraction in Clojure

Few days ago Mike Anderson wrote [a proposal][mike] for a generic matrix API in Clojure which could compete with NumPy. I wanted to write a similar post for months, but was reluctant to start. This problem is very dear to me. Basically, it is a matter if I can use Clojure for most of my work, or it remains a toy language for me. Thanks to Mike for bringing the question up. Though, I have a different vision of how we should approach arrays and matrices in Clojure.

@astanin
astanin / indent-blocks.el
Created October 25, 2012 13:41
Move Emacs cursor to the begining and end of the current indentation block
;;; indent-blocks.el ---
;;; move to the begining and end of the current indentation block
;; Indent blocks are defined as a sequence of lines with the same or
;; bigger indent size than that of the current line.
;;
;; Indentat blocks are common in YAML, Python, and Haskell and other
;; markup and programming languages with significant indentation, and
;; in these languages they usually are semantic units.
;;
@astanin
astanin / ipython-plot3d.json
Created September 27, 2012 09:38
test ipython notebook feature
{
"metadata": {
"name": "plot 3D line"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@astanin
astanin / Hide_Search_Bar_in_Google_Reader.user.js
Created September 17, 2012 12:39
Hide Search Bar in Google Reader (GreaseMonkey script)
// ==UserScript==
// @name Hide Search Bar in Google Reader
// @namespace https://github.com/astanin
// @include http://www.google.com/reader/view/*
// @include https://www.google.com/reader/view/*
// @version 1.0
// @grant none
// ==/UserScript==
function hideById(barid) {
document.getElementById(barid).style.display = "none";