Skip to content

Instantly share code, notes, and snippets.

View trashvin's full-sized avatar
🤘
human knowledge belongs to the world

Marvin Trilles trashvin

🤘
human knowledge belongs to the world
View GitHub Profile
@trashvin
trashvin / StandardizeVersion.bat
Created April 26, 2023 15:45
DOS batch script that formats version to fixed length
rem example version : 21.2.5
rem output version: 21.02.05
setlocal enabledelayedexpansion
set /p version="Enter a version number: "
for /f "tokens=1-3 delims=." %%a in ("%version%") do (
set "major=%%a"
set "minor=%%b"
set "patch=%%c"
)
if "!patch:~1,1!"=="" set "patch=0!patch:~0,1!"
@trashvin
trashvin / TopMost.bat
Created December 12, 2022 11:13
Set an app window as top most in Windows (based on superuser post https://superuser.com/questions/1554533/make-windows-always-on-top-win10)
Echo TopMost.bat
@Echo Off
Echo This file compiles TopMost.vb to TopMost.exe
Echo TopMost.exe set a window on top or not
Echo To use
Echo TopMost Top ^<windowtitle^>
Echo TopMost Not ^<windowtitle^>
Echo E.G.
Echo TopMost Top Untitled - Notepad
Echo -----------------------------------------------------
@trashvin
trashvin / sample.cpp
Created August 10, 2022 16:18
Sample C++ code for loops and conditional expressions
// Example program
#include <iostream>
#include <string>
using namespace std;
int getAction()
{
int action = 0;
@trashvin
trashvin / Main
Created November 16, 2021 17:17
The "code" from Power Automate Desktop to demonstrate recursion when solving the factorial of a number. NOTE: you need to recreate the flow by pasting the code below in PAD. #DesktopFlowAsCode
# copy this codes to the Main flow in PAD. you may need to create the "theInput" input variable
Text.ToNumber Text: theNumber Number=> number
CALL compute_factorial
Display.ShowMessage Title: $'''Result''' Message: $'''Factorial = %result%''' Icon: Display.Icon.Information Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
@trashvin
trashvin / IsDoubleDivisible.cpp
Last active November 1, 2021 09:35
sample c++ code for checkingif double numbers are divisible to a number using modf
#include <iostream>
#include <math.h>
using namespace std;
bool isDivisible(double number, double divisor);
int main()
{
// generate 20 random numbers and checkif div by 10
for (int i = 0; i < 20; i++)
@trashvin
trashvin / Markdium-python.py
Created March 31, 2021 17:00
Markdium-How To Debug Jupyter Notebooks in Visual Studio Code
# count the number of mouse in list of devices
devices = ['laptop','mouse', 'charger', 'mouse', 'keyboard', 'mouse']
mouse_count = 0
for device in devices:
if device.upper() == 'MOUSE':
mouse_count += 1
print(f"mouse count : {mouse_count}")
@trashvin
trashvin / connect.py
Created January 19, 2020 15:28
Connect to IBM DB2 instance from Jupyter Notebook using Python
import ibm_db
dsn_hostname = "dashdb-txn-sbox-yp-dal09-04.services.dal.bluemix.net" # e.g.: "dashdb-txn-sbox-yp-dal09-04.services.dal.bluemix.net"
dsn_uid = "121a1we" # e.g. "abc12345"
dsn_pwd = "xfgfdg121212" # e.g. "7dBZ3wWt9XN6$o0J"
dsn_driver = "{IBM DB2 ODBC DRIVER}"
dsn_database = "BLUDB" # e.g. "BLUDB"
dsn_port = "50000" # e.g. "50000"
dsn_protocol = "TCPIP" # i.e. "TCPIP"
@trashvin
trashvin / Module1.vb
Last active November 10, 2019 16:08
List processing example VB.NET
Imports System.IO
Imports System.Collections.Generic
Imports System.Xml
Module Module1
Sub Main()
' Read the sample file and populate list
Dim taxes As List(Of Tax) = GetData("xDataSample.txt")
@trashvin
trashvin / downtime.py
Created May 30, 2019 09:47 — forked from waleedahmad/downtime.py
Python script to monitor your internet down time
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import csv
import sys
import time
import socket
import datetime
@echo off
ECHO **********************************************************
ECHO NOTE :
ECHO Code Analysis is enabled by default and for a good reason
ECHO Use this script at your own risk
ECHO **********************************************************
ECHO .
ECHO Starting Visual Studio 2013 with Code Analysis OFF
set DevDivCodeAnalysisRunType=Disabled
devenv