Skip to content

Instantly share code, notes, and snippets.

View vkushnir's full-sized avatar

Vladimir Kushnir vkushnir

  • Specavtomatica
  • Kazakhstan, Aqtau
View GitHub Profile
@vkushnir
vkushnir / promptconvert.py
Created July 29, 2023 05:16 — forked from watzon/promptconvert.py
Stable Diffusion WebUI to InvokeAI prompt conversion script
import re
import argparse
re_attention = re.compile(r"""
\\\(|
\\\)|
\\\[|
\\]|
\\\\|
\\|
@vkushnir
vkushnir / ldapsearch.sh
Created April 3, 2023 13:00 — forked from tsuchm/ldapsearch.sh
ldapsearch with Base64 decode
#!/bin/sh
/usr/bin/ldapsearch -o ldif-wrap=no "$@" | perl -MMIME::Base64 -Mutf8 -pe 's/^([-a-zA-Z0-9;]+):(:\s+)(\S+)$/$1.$2.&decode_base64($3)/e'
@vkushnir
vkushnir / Filetimes.py
Created April 28, 2022 11:05 — forked from Mostafa-Hamdy-Elgiar/Filetimes.py
Python Script to convert Microsoft widows file time to python date and also date to windows file time
#!/usr/bin/env python
# Copyright (c) 2009, David Buxton <[email protected]>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
@vkushnir
vkushnir / NPS-Config-Sync.ps1
Created May 26, 2021 04:08 — forked from Jamesits/NPS-Config-Sync.ps1
Sync 2 Network Policy Servers' configuration
###Network Policy Server Synchronization Script
#This script copies the configuration from the NPS Master Server and imports it on the secondary server.
#The Account that this script runs under must have Local Administrator rights to the NPS Master.
#This was designed to be run as a scheduled task on the NPS Secondary Servers on an hourly,daily, or as-needed basis.
# Modified from https://deployhappiness.com/two-network-policy-server-tricks-subnets-and-syncing/
###Variables
#NPSMaster - Your Primary Network Policy Server you want to copy the config from.
$NPSMaster = "adds0.corp.contoso.com"
$NPSSecondary = "adds1.corp.contoso.com"
def ip2hex(cidr, router):
addr, mask = cidr.split("/")
mask = int(mask)
addr = [("%2s" % hex(int(i))[2:]).replace(" ", "0") for i in addr.split(".") if i != "0"]
parts = mask/8 - len(addr)
if mask%8 > 0:
parts += 1
if parts > 0:
for i in range(int(parts)):
addr.append("00")