Skip to content

Instantly share code, notes, and snippets.

View RodionGork's full-sized avatar

Rodion Gorkovenko RodionGork

View GitHub Profile
print('Running the code from Gist passed in the url')
print()
print('Triangle Numbers:')
for i = 1, 13 do
print(i, i * (i+1) / 2)
end
@RodionGork
RodionGork / test2.py
Created April 30, 2019 08:02
Neural network in Py
from random import random
import math
def dot(a, b):
return sum([k * v for k, v in zip(a, b)])
def sig(x):
return 1 / (1 + math.exp(-x))
@RodionGork
RodionGork / led-chain.ino
Created September 13, 2018 21:06
Led chain for Arduino
// эффекты описываются отдельными массивами
// в каждом несколько строчек по 5 символов
// соответствующих 5 светодиодам
// каждая строчка - следующее состояние (шаг)
// для данного эффекта
// (в принципе они могут быть собраны в один массив)
// первый эффект просто перемигивается
// четными и нечетными светодиодами
char* effect0[] = {
@RodionGork
RodionGork / pulsemeter_v3.ino
Last active May 17, 2018 04:25
Final Pulsemeter
#define NAVG 128
#define SENSOR_INPUT A3
#define SENSOR_INPUT2 A1
#define NORMAL_BUTTON 13
#define FILTER_BUTTON 2
#define PULSE_BUTTON 3
#define RED_LED 9
@RodionGork
RodionGork / rebar.config
Last active April 22, 2018 12:14
elvis in rebar3
{erl_opts, [debug_info]}.
{deps, []}.
{profiles, [
{test, [
{deps, [
{meck, "0.8.8"}
]},
{plugins, [
{rebar3_lint, {git, "https://github.com/project-fifo/rebar3_lint.git", {tag, "0.1.2"}}}
]},
@RodionGork
RodionGork / fire.asm
Created January 26, 2018 06:12
Fire in assembly 86
ideal
p386
SCR_W = 320
SCR_H = 200
STARTLINE = 70
assume cs:code,ds:code
segment code public
@RodionGork
RodionGork / pom.xml
Created July 19, 2015 15:05
sample xml for downloading
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>restdemo</groupId>
<artifactId>rest-testing</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>rest-testing</name>
@RodionGork
RodionGork / index.php
Created January 13, 2015 06:11
Very basic web-application in PHP, allowing to store and retrieve info with the help of json file
<?php
function loadData() {
$file = file_get_contents('data.json');
if ($file === false) {
$file = '[]';
}
$data = json_decode($file);
return empty($data) ? array() : $data;
}
public void generate(String path) {
System.out.println("Creating " + cores + " threads...");
ExecutorService service = Executors.newFixedThreadPool(cores);
prepareWords(false);
for (int i = 0; i < numFiles; i++) {
String name = String.format("%s/%08d.txt", path, i);
service.execute(new FileGenerator(name));
}
service.shutdown();
try {