Skip to content

Instantly share code, notes, and snippets.

View SysProfile's full-sized avatar
🏠
Working from home

SysProfile

🏠
Working from home
  • Ciudad de Buenos Aires
  • 00:56 (UTC -03:00)
View GitHub Profile
@SysProfile
SysProfile / Example vMix - jSON2XML.vb
Last active March 16, 2025 23:18
jSON2XML Pharser
' Ejemplo de uso:
API.Function("SetDynamicValue1", Value:="datos")
API.Function("SetDynamicValue2", Value:="{""persona"":{""nombre"":""Juan"",""edad"":30}}")
API.Function("ScriptStart", Value:="jSON2XML")
Luego, para leer el resultado:
Dim xml As String = API.XML()
Dim doc As New Xml.XmlDocument()
doc.LoadXml(xml)
Dim nodo As Xml.XmlNode = doc.SelectSingleNode("//dynamic/value[@key='DynamicValue2']")
Dim valor As String = If(nodo IsNot Nothing, nodo.InnerText, "No encontrado")
@SysProfile
SysProfile / vMix - MusicReload.vb
Last active March 11, 2025 01:06
Automatically reload vMix song list from a folder
Dim xmlDoc As New XmlDocument
xmlDoc.LoadXML(API.XML())
Dim inputName As String = "List"
Dim musicPath As String = String.Empty
musicPath = "D:\UniverFlix\@Common\Audios"
'musicPath = IO.Path.GetDirectoryName(xmlDoc.SelectSingleNode("/vmix/preset").InnerXml) & "\Audios"
Dim inputNode As Xml.XmlNode = xmlDoc.SelectSingleNode("/vmix/inputs/input[@shortTitle='" & inputName & "']")
If inputNode IsNot Nothing Then
Dim state As String = inputNode.Attributes("state").Value
Dim files() As String = IO.Directory.GetFiles(musicPath, "*.mp3")
@SysProfile
SysProfile / vMix - Auto Location Weather.vb
Last active March 12, 2025 14:03
vMix Script Weather Information with Automatic Location Detection
'Cómo se utiliza el código
'How to use the code
'
'Label: Temperature
'Dim strTemp As String = String.Format("{0:0.0}", Microsoft.VisualBasic.Val(xmlDoc.SelectSingleNode("/current/temperature").Attributes("value").Value))
'API.Function("SetText", Input:="My input", Value:=strTemp, SelectedName:="myTitle.Text")
'
'This command changes the background image:
'Dim strImage As String = "http://openweathermap.org/img/wn/" & xmlDoc.SelectSingleNode("/current/weather").Attributes("icon").Value & ".png"
'API.Function("SetImage", Input:="My input", Value:= strImage)
@SysProfile
SysProfile / SECONDS_BETWEEN_TIMESTAMP.sql
Created May 24, 2023 15:56
Returns the number of seconds between two dates with times. You can indicate if you want to include only working days. If you add the table, holidays are excluded
DROP FUNCTION IF EXISTS SECONDS_BETWEEN_TIMESTAMP;
DELIMITER $$
CREATE FUNCTION `SECONDS_BETWEEN_TIMESTAMP`(START_TIMESTAMP TIMESTAMP, END_TIMESTAMP TIMESTAMP, RETURN_RESULT VARCHAR (20)) RETURNS BIGINT(20) CHARSET utf8
READS SQL DATA
DETERMINISTIC
BEGIN
DECLARE TOTAL_SECS INTEGER;
DECLARE START_DATE DATE;
DECLARE END_DATE DATE;
DECLARE TOTAL_DAY_SAT INTEGER;
@SysProfile
SysProfile / BIG_SEC_TO_TIME_WITH_DAY.sql
Last active May 24, 2023 15:40
MySQL/MariaDB SEC_TO_TIME limit: This is a version with some improvements, the original post is here: https://gist.github.com/NaWer/8333736
DROP FUNCTION IF EXISTS BIG_SEC_TO_TIME_WITH_DAY;
DELIMITER $$
CREATE FUNCTION BIG_SEC_TO_TIME_WITH_DAY(SECS BIGINT, SHOWDAYS BOOLEAN)
RETURNS TEXT
READS SQL DATA
DETERMINISTIC
BEGIN
/* Basically you can send the seconds (beyond the limit of the SEC_TO_TIME() function) and you decide if it is expressed only in hours or days. */
DECLARE DAYS TEXT;
DECLARE HOURS TEXT;