Skip to content

Instantly share code, notes, and snippets.

View yovchev's full-sized avatar
🗺️
The obstacle is the path.

Daniel Yovchev yovchev

🗺️
The obstacle is the path.
View GitHub Profile
@yovchev
yovchev / birthday.liquid
Last active October 21, 2022 20:21
Birthday Gifts
{% assign dob = '1990-05-31 00:00' %}
{% assign claimed = '2022-06-01 18:48' %}
{% assign nowYear = 'now' | date: '%Y' %}
{% assign nowEpoch = 'now' | date: '%s' %}
{% assign nowTimestamp = 'now' | date: "%Y-%m-%d %H:%M" %} <!-- optional -->
{% assign claimedEpoch = claimed | date: '%s' %}
{% assign claimedTimestamp = claimed| date: "%Y-%m-%d %H:%M" %} <!-- optional -->
@yovchev
yovchev / main.hs
Created August 11, 2020 12:35
Haskel Primes with Infinite Data Structures
-- Computerphile Infinite Data Structures see https://youtu.be/bnRNiE_OVWA
-- Output the factors of n
factors n = [x | x <- [1..n], mod n x == 0]
-- Twin primes
twin (x,y) = y==x+2
-- Test n is prime number
prime n = factors n == [1,n] -- filter prime [1..]
-- Infinite primes list
primes = sieve [2..]
@yovchev
yovchev / MD5Hex.vb
Last active December 2, 2019 22:51
Excel, Access VBA Function to create MD5 from text
Public Function MD5Hex(textString As String) As String
Dim enc
Dim textBytes() As Byte
Dim bytes
Dim oUTF8
Dim outstr As String
Set oUTF8 = CreateObject("System.Text.UTF8Encoding")
Set enc = CreateObject("System.Security.Cryptography.MD5CryptoServiceProvider")
:: Open up regedit.exe and add an entry to the batch file to make the doskey commands permanent for each cmd session.
:: HKEY_CURRENT_USER\Software\Microsoft\Command Processor
:: Add a new String Value called AutoRun and set the absolute path in the value of C:\Windows\bin\macros.doskey
:: Doskey Documentation
:: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb490894(v=technet.10)
:: reg add "HKCU\Software\Microsoft\Command Processor" /v Autorun /d "doskey /macrofile=\"C:\Windows\bin\macros.doskey\"" /f
:: reg query "HKCU\Software\Microsoft\Command Processor" /v Autorun
@yovchev
yovchev / cmdhere.reg
Created July 22, 2017 14:42
Get back open here cmd after windows 10 update for powershell
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\cmdprompt]
@="@shell32.dll,-8506"
"Extended"=""
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\Directory\shell\cmdprompt\command]
@="cmd.exe /s /k pushd \"%V\""
@yovchev
yovchev / config-highlight.cfg
Created July 21, 2017 15:59
Python 3 IDLE IDE dark highlights
[Obsidian]
definition-foreground = #678CB1
error-foreground = #FF0000
string-background = #293134
keyword-foreground = #93C763
normal-foreground = #E0E2E4
comment-background = #293134
hit-foreground = #E0E2E4
builtin-background = #293134
stdout-foreground = #678CB1
@yovchev
yovchev / pauseAtLayer.py
Created March 3, 2017 20:12
Cura Plugin to pause on layer with delay.
#Name: Pause at layer
#Info: Pause the printer at a certain layer
#Depend: GCode
#Type: postprocess
#Param: pauseLevel(float:10) Pause level
#Param: parkX(float:190) Head park X (mm)
#Param: parkY(float:190) Head park Y (mm)
#Param: moveZ(float:0) Head move Z (mm)
#Param: retractAmount(float:5) Retraction amount (mm)
#Param: pauseAmount(float:1) Pause (seconds)
@yovchev
yovchev / Context.sublime-menu
Created November 12, 2016 15:48
CMD Sublime Text 3 Package
[
{ "command": "cmd" }
]
@yovchev
yovchev / angular-owl-carousel-2.js
Last active July 19, 2017 08:48
Use Owl Carousel 2 with angular
@yovchev
yovchev / store_device_position.sql
Last active August 29, 2015 14:04
Traccar insertPosition SQL distance algorithm
-- --------------------------------------------------------------------------------
-- Routine store_device_position
-- Note: This need to be saved as a stored procedure in your mysql database
-- you can check this link how to set up stored procedure
-- http://stackoverflow.com/questions/6115573/how-do-i-view-my-stored-procedures-in-phpmyadmin
-- --------------------------------------------------------------------------------
DELIMITER $$
CREATE DEFINER=`remote`@`%` PROCEDURE `store_device_position`(IN distance varchar(20), min_distance int(10), last_id bigint(20),
device_id bigint(20), rec_time datetime, valid tinyint(1), latitude double, longitude double, altitude double,