Skip to content

Instantly share code, notes, and snippets.

View anastasiia-kornilova's full-sized avatar

Anastasiia Kornilova anastasiia-kornilova

View GitHub Profile
@echo off
REM Usage: send_files.cmd <path to scripts dir> <file with ip addresses>
rem example: C:\\TRIKStudio\\send_files.cmd C:\Users\Dell\Desktop\send_files ip_adr.txt
Setlocal EnableDelayedExpansion
set TRIK_DIR=%~dp0
set WINSCP_PATH=%TRIK_DIR%\winscp\winscp.com
set SCRIPT_PATH=%1
SET mydir=%cd%
set PUT_ALL=
@anastasiia-kornilova
anastasiia-kornilova / run_2d_model.cmd
Last active February 9, 2021 11:01
Script example for running TRIK Studio 2d-model from external IDEs (PyCharm/VSCode), please, adapt it for your development process if necessary
@echo off
REM Usage: win_scr.cmd <full path to dir with fields> <relative path to js file>
for /f "tokens=2 delims=:." %%x in ('chcp') do set cp=%%x
chcp 1251>nul
SET TRIK_DIR=%~dp0
SET FIELDS_PATH=%1
echo %FIELDS_PATH%
SET DEFAULT_PROJECT=%FIELDS_PATH%\default.qrs
IF EXIST %DEFAULT_PROJECT% (
SET PROJECT_TYPE=xml
#!/bin/bash
# Usage: unix_scr.sh <path to fields dir> <path to js file>
TRIK_DIR=${0%/*}
FIELDS_PATH=$1
DEFAULT_PROJECT=$FIELDS_PATH/1.qrs
if [ -f "$DEFAULT_PROJECT" ]; then
PROJECT_TYPE=xml
else
PROJECT_TYPE=qrs
fi
@anastasiia-kornilova
anastasiia-kornilova / showExamples.js
Created July 28, 2019 13:03
"Show" method examples.
//rgb32
var photo = getPhoto();
brick.display().show(photo, 160, 120, "rgb32");
script.wait(5000);
//rgb888
pic = []
photo = getPhoto();
l = photo.length;
for (i = 0; i < l; i++) {
@anastasiia-kornilova
anastasiia-kornilova / gaussFilter1d.java
Created July 15, 2018 16:13
This is the simplest implementation of gaussian_filter1d from Python scipy library.
import static java.lang.Math.*;
public class GaussSmooth {
private static double gauss(double sigma, double x) {
double expVal = -0.5 * (pow(x, 2) / pow(sigma, 2));
return exp(expVal);
}
private static double[] gaussKernel1d(double sigma, int lw) {
var time = 2000;
var cpr = [64, 64, 64, 64];
var countTicks = function(motorPort, encoderPort, time) {
var motor = brick.motor(motorPort);
var encoder = brick.encoder(encoderPort);
var encBegin = encoder.readRawData();
motor.setPower(100);
script.wait(time);
var pic_large = [0x00,0x00,0x01,0x6a,0x68,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xac,0xac,0xa8,0xa8,0xa8,0xa8,0xa8,0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xcc,0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd4,0xd4,0xd4,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd0,0xd4,0xd4,0xd4,0xd4,0xd4,0xd4,0xd4,0xd4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0x