Skip to content

Instantly share code, notes, and snippets.

Maxim Velesyuk maximvl

Block or report user

Report or block maximvl

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
View gist:90dd7e35a469d1db2e7d73e13cb8961e
[warn] epoll_create: Too many open files
[warn] evutil_make_internal_pipe_: pipe: Too many open files
[err] evsig_init_: socketpair: Too many open files
View gist:8b1cf5068caf18f697d078c0c0e7c952
(a@127.0.0.1)10> Params2.
[{kill_if_fail,true},
{monitor_master,true},
{init_timeout,3000},
{startup_timeout,3000},
{startup_functions,[{erlang,node,[]}]},
{erl_flags,"-pa ../../_build/default/lib/*/ebin -config ../../test/test.config"}]
(a@127.0.0.1)11> ct_slave:start('b@127.0.0.1', Params2).
{error,boot_timeout,'b@127.0.0.1'}
(a@127.0.0.1)12>
View gist:ef9bba90cd4e3def143705ee6176b696
(cl-defun perl-move-cursor (pos &optional buffer)
(let ((window (get-buffer-window buffer t)))
(message "window: %s / pos: %s" window pos)
(if window
(progn
(goto-char pos)
(set-window-point window pos)
(message "char at %s" (point))
(message "char2 at %s" (window-point window)))
(goto-char pos))))
View l-system.red
Red [
Author: "Toomas Vooglaid"
Date: 25-9-2017
Description: {Experiments with L-System}
]
ctx: context [
scale: origin: length: len: angle: width: delta-width: times-length: delta-length: delta-angle: aliasing?: stack: commands: none
defaults: [
scale 2.0
origin 300x500
@maximvl
maximvl / abc-score.red
Last active Sep 27, 2017
abc score for Red code
View abc-score.red
Red [
author: {Maxim Velesyuk}
usage: {
abc-score? <block of code>
abc-score? %file.red
abc-score? :some-function
}
description: {
The ABC software metric defines an ABC score as a triplet of values that represent the size of a set of source code statements.
An ABC score is calculated by counting the number of assignments (A), number of branches (B), and number of conditionals (C) in a program.
View gist:8154e0776f671f7b8132bb1a498d4960
>> mal/parser/run "{1 2}"
-->
match: [(error: false) any whitespace collect [ahead "("
input: "{1 2}"
match: [any whitespace collect [ahead "(" mal-list (probe
input: "{1 2}"
-->
==> matched
<--
match: [whitespace collect [ahead "(" mal-list (probe "fo
@maximvl
maximvl / info.red
Created Sep 4, 2017 — forked from toomasv/info.red
To get info about any function
View info.red
Red []
info: func ['fn /name /intro /args /refinements /locals /return /spec
/arg-num /arg-names /arg-types /ref-names /ref-types /ref-num /type
/local intr ars refs locs ret arg ref typ
][
intr: copy "" ars: make map! copy [] refs: make map! copy [] locs: copy [] ret: copy [] typ: ref-arg: ref-arg-type: none
if lit-word? fn [fn: to-word fn]
unless find [op! native! function! action!] type?/word get fn [
cause-error 'user 'message ["Only function types accepted!"]
]
@maximvl
maximvl / python.red
Last active Aug 22, 2017
python game
View python.red
Red [
author: {Maxim Velesyuk}
description: {
A Snake Game / basic version
specification by Edward de Jong, version 1
The game runs at 6 frames per second, and the snake moves one cell per frame. If the snake moves into the apple the length is increased by one, a crunch sound is emitted, and the apple is moved to a new cell. If the snake crosses over itself, then a beep is emitted and the part of the snake from that cell onward is erased. The snake wraps around the board in all four directions.
The playing board, drawn solid black, is subdivided into square cells of 42 points at the screen resolution. Since the window size will not be an even number of cells, the cells are stretched slightly so that all screen space is used by the grid. At the start, the snake is set to length 1 and positioned at cell (4,4). The apple, which is the goal of the snake to eat, is one cell drawn as a circle in HTML color crimson, and is placed at a random location on the board.
At the start of the game the snake is paused. A
View colors.red
Red [
author: { Maxim Velesyuk }
description: {
colors palette showcase
}
]
sys-words: words-of system/words
colors: copy []
forall sys-words [
@maximvl
maximvl / state.red
Created Jul 22, 2017
Red parse + states example
View state.red
Red []
parser: context [
state: []
rules: [
any [
number! (append state 'number) |
word! (append state 'word) |
time! (append state 'time)
]
You can’t perform that action at this time.