The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,423 other followers

Archive for the ‘Scripting’ Category

Hunting for Beyond Compare on your system: bc.bat

Posted by jpluimers on 2018/10/23

For my archive bc.bat it finds Beyond Compare, then starts it with the given command line parameters. It prefers version 4 over version 3 and user settings over system settings:

:begin
@echo off
  setlocal
  IF /I %PROCESSOR_ARCHITECTURE% == amd64 goto :x64
  IF /I %PROCESSOR_ARCHITEW6432% == amd64 goto :x64
  goto :x86
:x64
  :: OS is 64bit
  set hkcuBaseKey=HKEY_CURRENT_USER\Software\Scooter Software\Beyond Compare
  set hklmBaseKey=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Scooter Software\Beyond Compare
  
  goto :findBC
:x86
  :: OS is 32bit
  set hkcuBaseKey=HKEY_CURRENT_USER\Software\Scooter Software\Beyond Compare
  set hklmBaseKey=HKEY_LOCAL_MACHINE\SOFTWARE\Scooter Software\Beyond Compare
  goto :findBC
:findBC
  :: https://gist.github.com/rojepp/634908
  :: http://stackoverflow.com/questions/5369528/windows-batch-reg-query-key-value-to-a-variable-but-do-not-display-error-if-key
  set SupportedBeyondCompareVersions=3, 4
  for %%v in (%SupportedBeyondCompareVersions%) do (
    for /f "usebackq tokens=2* delims= " %%c in (`reg query "%hkcuBaseKey% %%v" /v ExePath 2^>NUL`) do (
      call :do set bcExe="%%d"
    )
  )
  if not [%bcExe%]==[] goto :foundBC
    for /f "usebackq tokens=2* delims= " %%c in (`reg query "%hkcuBaseKey%" /v ExePath 2^>NUL`) do (
      call :do set bcExe="%%d"
    )
  if not [%bcExe%]==[] goto :foundBC
  for %%v in (%SupportedBeyondCompareVersions%) do (
    for /f "usebackq tokens=2* delims= " %%c in (`reg query "%hklmBaseKey% %%v" /v ExePath 2^>NUL`) do (
      call :do set bcExe="%%d"
    )
  )
  if not [%bcExe%]==[] goto :foundBC
    for /f "usebackq tokens=2* delims= " %%c in (`reg query "%hklmBaseKey%" /v ExePath 2^>NUL`) do (
      call :do set bcExe="%%d"
    )
:foundBC
  if [%bcExe%]==[] ( echo no bc.exe found in registry) else (
    echo bcExe=%bcExe%
    if exist %bcExe% start "Beyond Compare" %bcExe% %*
    if not exist %bcExe% echo not found: [%bcExe%]
  )
:exit
  endlocal
:end
  goto :eof
:do
  ::echo %*
  call %*
  goto :eof

–jeroen

Posted in Batch-Files, Beyond Compare, Development, Power User, Scripting, Software Development | Leave a Comment »

Quickly finding and debugging jQuery event handlers with findHandlersJS – The Blinking Caret

Posted by jpluimers on 2018/10/16

tl;dr: Finding event handlers registered using jQuery can be tricky. findHandlersJS makes finding them easy, all you need is the event type and a jQuery selector for the elements where the events might originate.

I need to invest some time in using this: [WayBackQuickly finding and debugging jQuery event handlers with findHandlersJS – The Blinking Caret

Sourcecode: [WayBackraw.githubusercontent.com/ruidfigueiredo/findHandlersJS/master/findEventHandlers.js

References:

Via: [WayBackjavascript – Chrome Dev Tools : view all event listeners used in the page – Stack Overflow

–jeroen

Posted in Chrome, Development, Google, JavaScript/ECMAScript, Scripting, Software Development | Leave a Comment »

aha (Ansi HTML Adapter) with clickable URIs

Posted by jpluimers on 2018/10/02

aha is great to generate HTML from ANSI text (i.e. the coloured output on a Linux console).

But it doesn’t generate clickable URIs (it can’t yet by itself as it only looks one character in the future).

The thread at https://github.com/theZiz/aha/issues/20 suggested a case-insensitive regex through sed but the exact suggestion failed for a few reasons I will explain below.

First the bash alias (requires both aha and perl):

Read the rest of this entry »

Posted in Software Development, Development, RegEx, Power User, *nix, Scripting, Perl, bash, *nix-tools, bash | Leave a Comment »

On my todo list: experiment with having multiple sendmail queue directories under /var/spool/mqueue

Posted by jpluimers on 2018/09/27

Right now my sendmail configuration handling my domains have one queue directory /var/spool/mqueue which means that each round of the queue processing handles all the outgoing mail in succession.

This is getting less OK because of the increased mail volume over time both on mail that gets in and needs to be forwarded and mail that needs to be bounced for various reasons like SPAM.

So below are some links helping me to sort out various things including having multiple queues (as then each round can handle each queue in parallel).

The default sendmail configuration is one mail queue and I hope to find out for what reason that is.

Background info:

Read the rest of this entry »

Posted in *nix, *nix-tools, Development, Power User, Scripting, sendmail, Software Development | Leave a Comment »

pure-bash-bible/README.md – book for doing things in bash without external tools

Posted by jpluimers on 2018/09/21

[WayBack] pure-bash-bible/README.md at master · dylanaraps/pure-bash-bible · GitHub:

The goal of this book is to document known and unknown methods of doing various tasks using only built-in bash features. Using the snippets from this bible can help remove unneeded dependencies from scripts and in most cases make them faster. I came across these tips and discovered a few while developing neofetchpxltrm and other smaller projects.

The snippets below are linted using shellcheck and tests have been written where applicable. Want to contribute? Read the CONTRIBUTING.md. It outlines how the unit tests work and what is required when adding snippets to the bible.

See something incorrectly described, buggy or outright wrong? Open an issue or send a pull request. If the bible is missing something, open an issue and a solution will be found.

Via:

jeroen

Posted in *nix, *nix-tools, bash, bash, Development, Power User, Scripting, Software Development | Leave a Comment »

 
%d bloggers like this: