Skip to content

Instantly share code, notes, and snippets.

View pduchnovsky's full-sized avatar
🐢

pduchnovsky

🐢
View GitHub Profile
# Restart Adapter when not UP (intel i225-v and i226-v issue workaround)
# Script developed by pduchnovsky
# https://duchnovsky.com/2023/02/automated-adapter-restart/
$AdapterName = "Ethernet"
$PowerShellPath = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
$Argument = "-command `"Get-NetAdapter $AdapterName | ? status -ne up | Restart-NetAdapter`""
$Name = "Restart Adapter"
$Trigger = New-ScheduledTaskTrigger -AtStartup
$Action = New-ScheduledTaskAction -Execute $PowerShellPath $Argument
$Settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -ExecutionTimeLimit 0
@pduchnovsky
pduchnovsky / render-image.html
Last active December 11, 2023 11:40
HUGO: Native image 'lazy' loading, fingerprinting, responsiveness | https://duchnovsky.com/2020/11/native-image-lazy-load/
<!-- layouts/_default/_markup/render-image.html -->
<!-- Developed/Adapted by pduchnovsky, https://duchnovsky.com/2020/11/native-image-lazy-load/ -->
{{ $img := "" }}{{ $thumb := "" }}{{ $srcset := slice }}
{{ $src := ( .Destination | safeURL ) }}
{{ $alt := .PlainText }}
{{ $caption := .Title | safeHTML }}
{{ $imgPath := add "/content" $src }}
{{ if fileExists $imgPath }}
{{ $img = imageConfig $imgPath }}
@pduchnovsky
pduchnovsky / style.css
Last active December 11, 2023 11:39
CSS Gallery functionality for practically any SSG | https://duchnovsky.com/2020/11/gallery-function-css
img {
height: auto;
pointer-events: none;
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Old versions of Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
supported by Chrome, Edge, Opera and Firefox */
@pduchnovsky
pduchnovsky / disqus.html
Last active December 11, 2023 11:39
Disqus 'on-click' for your Hugo generated pages | https://duchnovsky.com/2020/11/disqus-on-click-for-hugo/
<!-- Adapted/developed by pduchnovsky, https://duchnovsky.com/2020/11/disqus-on-click-for-hugo/ -->
{{- if and (not (eq (.Site.DisqusShortname | default "") "")) (eq (.Params.disableComments | default false) false) -}}
{{- if .Site.Params.disqusOnClick -}}
{{- $pc := .Site.Config.Privacy.Disqus -}}
{{- if not $pc.Disable -}}
{{- if .Site.DisqusShortname -}}
<section id="disqus" style="text-align: center">
<button
class="disqus-comment-count"
data-disqus-identifier="{{ .File.UniqueID }}"
@pduchnovsky
pduchnovsky / optimize.sh
Last active December 11, 2023 11:40
Image size optimization for webpages jpg/png | https://duchnovsky.com/2020/11/images-optimization-for-web/
#!/bin/bash
# Script adapted by pduchnovsky
# https://duchnovsky.com/2020/11/images-optimization-for-web/
# Add list of folder names to ignore array here, separated by space
ignore=("./themes/*" "./resources/*" "./assets/*")
# Array of png optimizers with their arguments
optimizers=(
"optipng -nb -nc"
@pduchnovsky
pduchnovsky / monitor.sh
Last active December 11, 2023 11:40
Bitbucket paused pipelines monitoring script | https://duchnovsky.com/2020/11/bitbucket-pipelines-monitoring/
#!/bin/bash
# Script developed by pduchnovsky
# https://duchnovsky.com/2020/11/bitbucket-pipelines-monitoring/
#Variables definition:
BITBUCKET_CREDS="username:app_password"
BITBUCKET_WORKSPACE="workspace-name"
BITBUCKET_REPO_LIST="repo-1 repo-2 repo-3"
BITBUCKET_BRANCH_LIST="primary secondary tertiary"