Skip to content

Instantly share code, notes, and snippets.

View amironov73's full-sized avatar
:octocat:
Learning

Alexey Mironov amironov73

:octocat:
Learning
View GitHub Profile
@amironov73
amironov73 / Main.axaml
Created December 5, 2022 03:19
Простейший калькулятор на Avalonia
<UserControl xmlns="https://github.com/avaloniaui">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBox Name="firstBox">123.45</TextBox>
<TextBox Name="secondBox">345.67</TextBox>
<Button Name="button">Сложить</Button>
<TextBox Name="sumBox" IsReadOnly="True"></TextBox>
</StackPanel>
</UserControl>
@amironov73
amironov73 / VirtualNumbersGrid.cs
Created June 21, 2021 11:26
Виртуальный режим DataGridView
using System.Windows.Forms;
namespace WinFormsApp2
{
public sealed class VirtualNumbersGrid
: DataGridView
{
private readonly int _firstNumber, _count;
public VirtualNumbersGrid(int firstNumber, int count)
@amironov73
amironov73 / Program.cs
Last active May 13, 2021 03:04
Fast simple conversion from Int32 to String
using System;
Int2String(0);
Int2String(1234567);
Int2String(-1234567);
static void Int2String(int value)
{
Span<char> span = stackalloc char[20];
@amironov73
amironov73 / app.d
Created May 5, 2019 07:36
Random numbers generation in D
import std.stdio, std.random;
void main()
{
auto rng = Random(unpredictableSeed);
for(int i = 0; i < 100; i++) {
auto r = uniform(100_000, 999_999, rng);
writeln(r);
}
}
@amironov73
amironov73 / Synology-Diskstation-Git.md
Created April 29, 2019 10:26 — forked from walkerjeffd/Synology-Diskstation-Git.md
Instructions for setting up git server on Synology Diskstation

Configure Synology NAS as Git Server

Instructions for setting up a git server on a Synology NAS with Diskstation. Specifically, I am using a DS414 with DSM 5.0.

Set Up User and Folder

  • Create user gituser via Diskstation interface (with File Station and WebDAV privilages)
  • Add new shared folder called git (located at /volume1/git) with read/write access for gituser and admin. This folder will hold all the repos.
  • Install Git Server package via Diskstation
@amironov73
amironov73 / .travis.yml
Created April 27, 2019 07:39 — forked from ryboe/.travis.yml
Example .travis.yml for Golang
# use the latest ubuntu environment (18.04) available on travis
dist: xenial
language: go
# Force-enable Go modules. Also force go to use the code in vendor/
# These will both be unnecessary when Go 1.13 lands.
env:
- GO111MODULE=on
- GOFLAGS='-mod vendor'
@amironov73
amironov73 / slice_exists.go
Created March 25, 2019 10:15 — forked from r6m/slice_exists.go
golang check if item exists in slice
package main
import(
"fmt"
"reflect"
)
func main() {
items := []int{1,2,3,4,5,6}
fmt.Println(SliceExists(items, 5)) // returns true
@amironov73
amironov73 / connector.js
Created March 13, 2019 11:41
Simplest Node.js IRBIS64 client
var net = require('net');
var clientId = 100000 + Math.floor(Math.random() * 900000);
var queryId = 1;
var login="librarian", password = "secret";
function makePacket(code, tail) {
var result = code + "\nC\n" + code + "\n"
+ clientId.toString() + "\n"
+ queryId.toString() + "\n"
@amironov73
amironov73 / hello.js
Created March 13, 2019 11:21
JavaScript async/await
async function first() {
console.log('First');
return 1;
}
async function second() {
console.log('Second/1');
const result1 = await first();
console.log('Second/2');
@amironov73
amironov73 / nodejs-tcp-example.js
Created March 12, 2019 11:54 — forked from tedmiston/nodejs-tcp-example.js
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');