Skip to content

Instantly share code, notes, and snippets.

View skokhanovskiy's full-sized avatar

Stepan Kokhanovskiy skokhanovskiy

View GitHub Profile
@skokhanovskiy
skokhanovskiy / Dockerfile
Last active October 5, 2023 09:55
Concurrent map write on cache export in Docker / Moby / Buildkit
FROM ubuntu
ARG REBUILD_SEED=0
ARG SIZE=1M
# Common set of layers
RUN head -c "${SIZE}" </dev/urandom >/random00
RUN head -c "${SIZE}" </dev/urandom >/random01
RUN head -c "${SIZE}" </dev/urandom >/random02
RUN head -c "${SIZE}" </dev/urandom >/random03
#!/bin/sh
set -e
if which netplan 1>&2 2>/dev/null; then
ip -br link show up | awk '{print $1}' | while read -r int; do
if netplan ip leases 2>/dev/null; then
echo "${int} auto"
else
echo "${int} manual"
@skokhanovskiy
skokhanovskiy / build.gradle
Created September 15, 2020 14:22
Task to download all dependencies for all targets in Gradle
// Task to download all dependencies for all targets
task downloadDependencies {
doLast {
rootProject.allprojects { project ->
Set<Configuration> configurations = project.buildscript.configurations + project.configurations
configurations.findAll { c -> c.canBeResolved }
.forEach { c -> c.resolve() }
}
}
}
@skokhanovskiy
skokhanovskiy / krb5.conf
Last active August 19, 2022 06:06
Example configuration files for libkrb5 and sssd for authentication with Active Directory
# This is an example of krb5.conf for authentication with Active Directory
# Tested on libkrb5-3 1.15-1+deb9u1
[libdefaults]
default_realm = EXAMPLE.COM
dns_lookup_realm = true
dns_lookup_kdc = true
forwardable = true
# Values for next three parameters should be used from Default Domain Policy GPO
$Server = 'SQL-APPS'
$ConnectionTimeout = 15
$MaxConnections = 500
$ConnectionStringFormat = 'Server = {0}; Connection Timeout = {1}; Max Pool Size = {2}; Integrated Security = True;'
$CommandQuery = 'SELECT 1'
$ConnectionString = $ConnectionStringFormat -f $Server, $ConnectionTimeout, $MaxConnections
$Connections = [System.Collections.ArrayList] @()
function New-PerfomanceCounterHash
{
[CmdletBinding()]
param
(
[Parameter()]
[Switch] $NotLocalized
)
$KeyName = 'Counter'
@skokhanovskiy
skokhanovskiy / Get-RandomString.ps1
Created July 28, 2017 13:17
Generate random string specified length
function Get-RandomString
{
[CmdletBinding()]
param
(
[Parameter(Position = 0, Mandatory = $true)]
[UInt32] $Length,
[Parameter()]
[String] $Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
@skokhanovskiy
skokhanovskiy / Send-Datagram.ps1
Last active July 28, 2017 13:10 — forked from hotstone/Send-Datagram
Send UDP datagram from Powershell
function Send-Datagram
{
[CmdletBinding(SupportsShouldProcess = $true)]
param
(
[Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)]
[AllowEmptyCollection()]
[AllowEmptyString()]
[AllowNull()]
[Alias('Data')]
@skokhanovskiy
skokhanovskiy / top-packages.sh
Created May 10, 2017 13:20
Get list of a manually installed packages sorted by size
apt-mark showmanual | while read -r package; do size=$(apt-cache --no-all-versions show $package | grep '^Installed-Size: ' | cut -f2 -d':' | xargs) && echo "$package $size"; done | sort -rnk2
SELECT
j.[name] [job_name],
s.[step_id] [step_number],
s.[step_name] [step_name],
s.[command] [step_query],
s.[database_name] [step_database]
FROM
[msdb].[dbo].[SysJobs] j
INNER JOIN [msdb].[dbo].[sysjobsteps] s ON s.[job_id] = j.[job_id]
WHERE