Skip to content

Instantly share code, notes, and snippets.

@smartXZX
smartXZX / powershell_profile.ps1
Created March 14, 2019 15:56
My powershell profile
# Ensure that Get-ChildItemColor is loaded
Import-Module Get-ChildItemColor
# Set l and ls alias to use the new Get-ChildItemColor cmdlets
Set-Alias l Get-ChildItemColor -Option AllScope
Set-Alias ls Get-ChildItemColorFormatWide -Option AllScope
Import-Module PSReadLine
Set-PSReadLineOption -HistoryNoDuplicates
@smartXZX
smartXZX / get_logged_users.cmd
Last active February 27, 2019 11:52
Get logged in users for Windows OS
query user /server:$SERVER
@smartXZX
smartXZX / split.yml
Created February 20, 2019 12:22
Ansible: Split variable and get first part lowered
- debug:
msg: {{ ansible_nodename.split(".")[0] | lower }}
@smartXZX
smartXZX / uninstall.ps1
Last active January 31, 2019 15:22
Uninstall software from powershell
$app = Get-WmiObject -Class Win32_Product | Where-Object {
$_.Name -match “HP ProLiant Health Monitor Service (X64)”
}
# or use query
$app = Get-WmiObject -Query "select * from Win32_Product where name='HP ProLiant Health Monitor Service (X64)'"
$app.Uninstall()
-- You have few options to use a network file as a backup source
-- Map network drive/path, hosting file, under SAME user as MS-SQL Server.
-- Use xp_cmdshell extended stored procedure to map network drive from inside of MS SQL (such way, command shell will have the same privilegies as the user account running SSMS)
-- allow changes to advanced options
EXEC sp_configure 'show advanced options', 1
GO
-- Update currently configured values for advanced options.
RECONFIGURE
@smartXZX
smartXZX / get-winversion.ps1
Created September 21, 2018 09:49
PS command to get Windows version
Get-ComputerInfo | select WindowsProductName, WindowsVersion, OsHardwareAbstractionLayer
@smartXZX
smartXZX / cleandocker.ps1
Created August 16, 2018 14:12
Remove old and unused Docker images and containers
alias drmae='docker rm $(docker ps -qa --no-trunc --filter "status=exited")'
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
@smartXZX
smartXZX / gist:8f5b99cd4c40f15120c8dde761ce10bc
Last active August 8, 2018 11:47
prometheus_operator_links.txt
http://joecreager.com/custom-configurations-with-prometheus-operator/
https://habr.com/company/flant/blog/353410/
@smartXZX
smartXZX / haproxy_elaticsearch.cfg
Last active June 15, 2018 15:56
Working backend in haproxy for elasticsearch
use_backend elasticsearch if { req.hdr(Host),regsub(:[0-9]+$,) -i elasticsearch.mydomain.local }
@smartXZX
smartXZX / grokiis2012.txt
Created June 14, 2018 15:13
grok iis log (win2012)
%{DATESTAMP:timestamp} %{HOSTNAME:source-ip} %{URIPROTO:method} %{URIPATH:request} (?:%{NOTSPACE:queryparam}|-) %{NUMBER:port} (?:%{NOTSPACE:username}|-) %{IPORHOST:clien-ip} %{NOTSPACE:useragent} (?:%{NOTSPACE:host}|-) %{NUMBER:status} %{NUMBER:sub-status} %{NUMBER:win32-status} %{NUMBER:time-taken}