Skip to content

Instantly share code, notes, and snippets.

Maxim Velesyuk maximvl

View GitHub Profile
View gist:de4a739b26ab15e88918824731dc5391
-module(dirtest).
-include_lib("wx/include/wx.hrl").
-behaviour(wx_object).
-export([start/0, init/1,
terminate/2, code_change/3,
handle_info/2, handle_call/3, handle_cast/2, handle_event/2]).
start() -> wx_object:start_link(?MODULE, [], []).
%% Callbacks
init(Config) ->
wx:new(Config),
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
@maximvl
maximvl / restarts.red
Last active Aug 14, 2019
CL condition-restarts in Red
View restarts.red
Red [
author: "Maxim Velesyuk"
description: "Common Lisp condition-restart system implementation for Red"
]
; utils
*word-counter*: 0
gen-word: does [
*word-counter*: *word-counter* + 1
to-word append "G-" to-string *word-counter*
@maximvl
maximvl / poor-mans-scopes.red
Last active Aug 14, 2019
Dynamic variables in Red
View poor-mans-scopes.red
Red [
author: "Maxim Velesyuk"
description: "Dynamic variables implementation for Red"
]
; utils
forskip: func ['series skipn body /local s] [
s: get series
while [ not tail? s ] [
do body
View game.red
Red [
description: {simple game}
author: {Maxim Velesyuk}
version: 2.2
changelog: {
2.2
* added sleep to the loop to reduce CPU load
2.1
* added win screen display time
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))))
@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 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
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
You can’t perform that action at this time.