Skip to content

Instantly share code, notes, and snippets.

View alkuzad's full-sized avatar

Dawid Gosławski alkuzad

View GitHub Profile
@alkuzad
alkuzad / destroy_and_GECK_docker_desktop.ps1
Last active November 1, 2023 09:01
Restart script to restart WSL, DockerDesktop and LxssManager. This script should unblock blocked wsl/docker-desktop.
# MIT License
# Copyright (c) 2023 Dawid Goslawski
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@alkuzad
alkuzad / all_ssm_parameters.py
Created January 4, 2022 17:11
all ssm parameters
def ssm_parameters():
ssm_path = "/example/path/" # / at the end
ssm = boto3.client('ssm', region_name='eu-west-1')
parameters = ssm.get_parameters_by_path(Path=ssm_path, WithDecryption=True)[
'Parameters'
]
return {x['Name'].replace(ssm_path, ""): x['Value'] for x in parameters}
@alkuzad
alkuzad / imap_delete.py
Created November 14, 2021 21:38
Delete email from python
from imaplib import IMAP4_SSL
try:
client = IMAP4_SSL("imap.gmail.com")
client.login(user, passw)
client.select("INBOX")
# https://datatracker.ietf.org/doc/html/rfc3501#section-6.4.4
typ, msgnums =client.search(None, '(FROM "wp.pl")')
package main
import (
"github.com/go-ping/ping"
"fmt"
"time"
)
func main() {
@alkuzad
alkuzad / duckduckgo-in-slack.bat
Created August 9, 2020 12:49
DuckDuckGo is free search engine, not spying as google
rem asar v3.0.3, slack 4.8.0
rem sed is from scoop git package, also in unxutils-separated or standard unxutils
set SLACK_HOME=%USERPROFILE%\scoop\apps\slack\current
npm install -g asar
cd %SLACK_HOME%\resources
asar extract app.asar slack-source
del app.asar
sed -i "s@searchGoogle@searchDuckDuckGo@g" slack-source/dist/main.bundle.js
sed -i "s@https://www.google.com/search?q=@https://duckduckgo.com/?q=@" slack-source/dist/main.bundle.js
@alkuzad
alkuzad / docker-cleanup.sh
Created June 23, 2020 13:52
Fully cleanup docker
docker system prune
docker image prune --all # remove also unused named images
@alkuzad
alkuzad / RefreshEnv.cmd
Last active August 19, 2019 10:41
Environment refresh to update environment variables on windows without re-opening console
@echo off
::
:: RefreshEnv.cmd
::
:: Batch file to read environment variables from registry and
:: set session variables to these values.
::
:: With this batch file, there should be no need to reload command
:: environment every time you want environment changes to propagate
::
@alkuzad
alkuzad / t..cmd
Created August 19, 2019 09:56
Set title for windows console
@echo off
for %%I in (.) do title %%~nxI
@alkuzad
alkuzad / hyperv_toggle.cmd
Created August 19, 2019 09:55
hyperv_toggle_docker.cmd
@echo off
bcdedit | findstr "hypervisorlaunchtype" | findstr Auto > nul
if %ERRORLEVEL% == 1 (bcdedit /set hypervisorlaunchtype auto 1>nul && echo HyperV ON / Docker Mode ) else (bcdedit /set hypervisorlaunchtype off 1>nul && echo HyperV OFF / Virtualbox Mode)
import jenkins.*
import jenkins.model.*
import hudson.*
import hudson.model.*
import org.apache.commons.io.IOUtils
def jenkinsCredentials = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
com.cloudbees.plugins.credentials.Credentials.class,
Jenkins.instance,
null,
null