Skip to content

Instantly share code, notes, and snippets.

@sengiv
sengiv / random-show-watch.py
Created April 18, 2024 12:43
Randomly selects and plays shows from multiple local file location. Nice for rewatching same series shows, but from random points.
import os
import random
import subprocess
import json
def get_mp4_files(paths, depth=1):
mp4_files = []
for path in paths:
if depth < 0:
return mp4_files
# Get the current PATH
$currentPath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path
# Your MSBuild path
$msbuildPath = "C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin"
# Create a new PATH
$newPath = $currentPath + ";" + $msbuildPath
# Set the new PATH
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath
@sengiv
sengiv / TextToSvg.js
Created April 6, 2023 00:32
Input text converts to nicely formatted SVG box
//FUNCTION
// This function attempts to create a new svg "text" element, chopping
// it up into "tspan" pieces, if the text is too long
static textToSvg(caption, x, y) {
//svg "text" element to hold smaller text lines
var svgTextHolder = document.createElementNS('http://www.w3.org/2000/svg', 'text');
svgTextHolder.setAttributeNS(null, 'x', x);
svgTextHolder.setAttributeNS(null, 'y', y);
svgTextHolder.setAttributeNS(null, 'font-size', 10);
@sengiv
sengiv / moto-verve-300-reset.txt
Created March 16, 2023 14:20
Reset Motorola Verve 300
reset the earbuds individually, not together,
then return them to the case,
take them out, let them sync together, leaving them 2 or 3 minutes,
once the left earbud has stopped flashing,
then turned on the phone BT and connected to the right earbud
@sengiv
sengiv / findInXml.js
Created March 5, 2023 08:48
Simple JS function to find and retrieve text from xml file
//gets events from EventDataList.xml
//for viewing in time legend
async function getEventDescription(eventName) {
//search for matching event name
var eventXmlList = window.$EventDataListXml.find('Event'); //get all event elements
var results = eventXmlList.filter(
function () {
var eventNameXml = $(this).children('Name').eq(0);
return eventNameXml.text() === eventName;
});
@sengiv
sengiv / R80X50-PQ-CCTV-Config.txt
Created October 21, 2022 00:58
ICsee R80X50-PQ CCTV Camera Config
stream:
camera:
- platform: generic
name: iCsee
still_image_url: "http://<CAMERA_IP_ADDRESS>/webcapture.jpg?user=admin&password=<PASSWORD>&command=snap&channel=1"
stream_source: "rtsp://<CAMERA_IP_ADDRESS>:554/user=admin&password=<PASSWORD>&channel=2&stream=0.sdp?real_stream"
@sengiv
sengiv / SetAppPATHForTerminal.ps1
Created October 14, 2022 16:12
When run will add a directory to cmd/powershell PATH, so for example this code will make azcopy command available in terminal
$InstallPath = 'C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy'
# Add InstallPath to the System Path if it does not exist
if ($env:PATH -notcontains $InstallPath) {
$path = ($env:PATH -split ";")
if (!($path -contains $InstallPath)) {
$path += $InstallPath
$env:PATH = ($path -join ";")
$env:PATH = $env:PATH -replace ';;', ';'
}
@sengiv
sengiv / Programming Rules Ordered By Priority
Created July 2, 2022 02:15
Programming Rules Ordered By Priority
1.Easy Readablilty
2.No Duplication
3.Performance Gain
Explantion:
When there is decision to be made between a comprimise
of Easy Readablity & No Duplication, make the decision in favor of Readability.
This will lead to code with easier maintainence down the road.
@sengiv
sengiv / Windows Force Hibernate
Created July 2, 2022 02:00
Windows Force Hibernate With Desktop Shortcut
Create shortcut with below target:
rundll32.exe powrprof.dll,SetSuspendState 0,1,0
@sengiv
sengiv / Disable Lock Screen - Windows 10
Created July 2, 2022 01:58
Steps To Disable Lock Screen - Windows 10 - Tested to be working for all scenarios, sleep, hibernate & restart
Open regedit
1.Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows
2.Right click on Windows and select New>Key
3.Name the new key Personalization
4.Right click on Personalization and select New>DWORD (32-Bit) Value
5.Name it NoLockScreen
6.Double click NoLockScreen and edit the value to be 1 (Hexadecimal) and click OK.
7.Restart the computer, and the lock screen should be disabled when it resumes from sleep.