Skip to content

Instantly share code, notes, and snippets.

View astanin's full-sized avatar

Sergey Astanin astanin

View GitHub Profile
@astanin
astanin / value_vs_manager.py
Created February 24, 2014 16:00
This script demonstrates the overhead of using SyncManager vs Value.
"""This script demonstrates the overhead of using SyncManager vs Value.
Output:
C double: 8.782e-07 sec per assignment
C struct: 8.795e-07 sec per assignment
Python class: 3.346e-07 sec per assignment
AutoProxy: 2.985e-05 sec per assignment
Method calls on AutoProxy seem to be two orders of magnitude slower.
@astanin
astanin / nbody2.ino
Last active August 29, 2015 14:17
nbody.ino with correct time measurement
/*
An implementation of the n-body benchmark for Arduino clones.
Expected output with TIME_STEPS = 50000000:
-0.169075164
-0.169059907
# time: ...
N-body benchmark (Java7 #2 1 Core):
@astanin
astanin / lcov-on-msys-howto.md
Last active August 29, 2015 14:22
How to install LCOV on Windows (in MSYS2)

See

@astanin
astanin / pipetable.md
Created July 29, 2015 18:06
Pipe table in GFM

Pipe-table generated by tabulate and rendered by Github:

item qty
spam 42
eggs 451
bacon 0
@astanin
astanin / pageintotwo.sh
Created January 29, 2010 20:24
Convert PDF to DjVu with cutting every page into two
#!/bin/bash
# растеризовать все страницы в двутональные картинки (для цветных убрать -mono)
pdftoppm -r 600 -mono $1 rawpage
# каждую страницу сжать в чёрно-белый DjVu (cjb2, для цветных использовать c44)
for p in `ls -1 rawpage-*.pbm`; do
# вырезать левую половину: -gravity West -crop 50%x100% +repage
# или правую: -gravity East -crop 50%x100% +repage
# обрезать поля: -trim +repage
@astanin
astanin / upsidedown.lhs
Created March 18, 2010 11:20
Upside down
#!/usr/bin/env runhaskell
> import Data.Char (toLower)
Once @malfet wrote: uʍop ǝpısdn ǝʇıɹʍ oʇ pǝsn ǝq uɐɔ sloqɯʎs sɔıʇǝuoɥd.
Indeed, there are upside-down pairs for most of the lower-case letters.
Only 'j' is a problem.
> abc = [ ('a', 'ɐ'), ('b', 'q'), ('c', 'ɔ'), ('d', 'p'), ('e', 'ə')
@astanin
astanin / tikz-anglearc.tex
Created May 26, 2010 16:26
Draw an angle on tikz plots (LaTeX)
% draw an angle arc on tikz plots
%
% #1: A point of ∠ABC
% #2: B point of ∠ABC
% #3: C point of ∠ABC
% #4: arc radius (length units)
% #5: arc style (e.g. fill=red!50!white or draw)
% #6: label
%
% Issues:
@astanin
astanin / twidge-unicode-from-getArgs.diff
Created June 3, 2010 13:50
Patch to twidge to fix Unicode support in getArgs
diff --git a/twidge.cabal b/twidge.cabal
index 6883036..428e628 100644
--- a/twidge.cabal
+++ b/twidge.cabal
@@ -49,7 +49,7 @@ Flag withBitly
Executable twidge
Build-Depends: network, unix, parsec, MissingH>=1.0.0,
mtl, base >= 4 && < 5, HaXml>=1.13.2, HaXml<1.19, hslogger, hoauth,
- ConfigFile, directory, HSH, regex-posix, utf8-string, binary,
+ ConfigFile, directory, HSH, regex-posix, utf8-string >= 0.3.5, binary,
@astanin
astanin / revdeps-by-license.hs
Created June 3, 2010 17:51
Count Hackage reverse dependencies by license type
{- Count reverse dependencies by license type.
Output on 20100603 (license, # of revdeps, # of packages, revdeps per package):
BSD3 33469 1519 22.033574720210666
LGPL 1018 99 10.282828282828282
GPL 603 334 1.8053892215568863
OtherLicense 300 77 3.896103896103896
PublicDomain 214 64 3.34375
BSD4 53 4 13.25
(tool-bar-mode 0)
(scroll-bar-mode 0)
(menu-bar-mode 0)
(defun add-subdirs-to-load-path (dir)
(let ((default-directory (concat dir "/")))
(normal-top-level-add-subdirs-to-load-path)))
;;; My location for external packages.
(add-to-list 'load-path "~/.emacs.d/site-lisp")