Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focused on the global SoftUni expansion: https://softuni.org

Svetlin Nakov nakov

🎯
Focused on the global SoftUni expansion: https://softuni.org
View GitHub Profile
@nakov
nakov / http-get.js
Created February 20, 2023 14:09
Shelly HTTP GET
View http-get.js
Shelly.call(
"HTTP.GET",
{"url": "https://api.zippopotam.us/us/90210"},
function (response) {
if (response && response.code && response.code === 200) {
print(JSON.stringify(response.body));
Shelly.emitEvent("HTTP-result", response.body);
}
else {
print("Error: HTTP request failed.");
@nakov
nakov / plugs-play-with-LED-lights.js
Created February 8, 2023 15:06
Shelly Plug: Play with LED
View plugs-play-with-LED-lights.js
function shellyPlugSChangeLEDColor(red, green, blue, brightness) {
let config = {
"config": {
"leds": {
"colors": {
"switch:0": {
"on": {
"rgb": [red, green, blue],
"brightness": brightness
}
@nakov
nakov / Output
Created February 8, 2023 13:35
Shelly: Number to String without Trailing Zeros
View Output
Num (standard): 123.131000
Num (no trailing zeros): 123.131
@nakov
nakov / ConsoleBasedMatrixEditor.cs
Created July 12, 2022 09:51
Console-Based Matrix Editor in C#
View ConsoleBasedMatrixEditor.cs
char[,] matrix = new char[,]
{
{ 'x', '-', '-', 'x', 'x'},
{ 'x', '-', '-', 'x', 'x'},
{ 'x', '-', '-', 'x', 'x'},
};
int x = 0;
int y = 0;
@nakov
nakov / Airfield.cs
Created June 15, 2022 20:49
Meal Plan
View Airfield.cs
using System;
using System.Collections.Generic;
using System.Linq;
namespace Drones
{
public class Airfield
{
public List<Drone> Drones { get; set; }
public string Name { get; set; }
@nakov
nakov / HtmlGenerateAndOpen.cs
Created May 23, 2022 10:49
Generate and Open HTML in C#
View HtmlGenerateAndOpen.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
File.WriteAllText("weather.html", "<html><h1>Weather</h1></html>");
var p = new Process();
p.StartInfo = new ProcessStartInfo("weather.html")
{
@nakov
nakov / TestsContactBookAndroidApp.cs
Created March 26, 2021 17:42
Appium Test for the ContactBook app
View TestsContactBookAndroidApp.cs
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Android;
using OpenQA.Selenium.Remote;
using System;
namespace AppiumTests_ContactBook
{
public class TestsContactBookAndroidApp
@nakov
nakov / APITestsContactBook.cs
Created March 12, 2021 17:45
ContactBook API Tests
View APITestsContactBook.cs
using NUnit.Framework;
using RestSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text.Json;
public class APITestsContactBook
{
@nakov
nakov / ffmpeg-avi-to-gif.cmd
Last active April 8, 2021 13:14
Create highly-optimized GIF from screencast video (MP4)
View ffmpeg-avi-to-gif.cmd
ffmpeg -i .\input.avi -vf scale=1280x720 -crf 0 -r 4 -an -y out.mp4
ffmpeg -i .\out.mp4 -vf palettegen=256 -y palette.png
ffmpeg -y -i .\out.mp4 -i palette.png -filter_complex paletteuse -y animation.gif
del out.mp4
del palette.png
@nakov
nakov / FileXor.cs
Created March 10, 2021 17:50
C# Encrypt / Decrypt File with XOR
View FileXor.cs
using System.IO;
void EncryptFile(string inputFile, string outputFile)
{
using (var fin = new FileStream(inputFile, FileMode.Open))
using (var fout = new FileStream(outputFile, FileMode.Create))
{
byte[] buffer = new byte[4096];
while (true)
{