This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# testing | |
docker run -it --rm busybox sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check physical and logical sector size | |
lsblk -o Name,PHY-SEC,LOG-SEC | |
# wipe disk | |
sudo shred -v -n1 -z /dev/sdx | |
# check bad sectors (readonly) | |
sudo badblocks -vs -b 4096 -c 65536 /dev/sdx | |
# check bad sectors and wipe disk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ipChangeHandler { | |
Write-Host "Detected an IP change..." | |
Write-Host "Collecting connections information..." | |
$connObjs = New-Object System.Collections.ArrayList | |
$ints = Get-NetIPAddress -AddressFamily IPv4 -PrefixOrigin Dhcp -AddressState Preferred | |
foreach ($int in $ints) { | |
$_alias = $int.InterfaceAlias | |
$_index = $int.InterfaceIndex | |
$_ipaddr = $int.IPAddress | |
$intCfg = $int | Get-NetIPConfiguration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class NativeMethods | |
{ | |
[DllImport("user32.dll")] | |
private static extern bool EnumDisplayMonitors(IntPtr hdc, IntPtr lprcClip, MonitorEnumDelegate lpfnEnum, IntPtr dwData); | |
private delegate bool MonitorEnumDelegate(IntPtr hMonitor, IntPtr hdcMonitor, ref Rect2 lprcMonitor, IntPtr dwData); | |
[DllImport("user32.dll")] | |
private static extern bool GetMonitorInfo(IntPtr hwnd, ref MonitorInfo mInfo); | |
[DllImport("Shcore")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<templateSet group="Python"> | |
<template name="for" value="for $VAR$ in $ITERABLE$: $END$" description="Iterate (for ... in ...)" toReformat="false" toShortenFQNames="true"> | |
<variable name="ITERABLE" expression="pyIterableVariable()" defaultValue=""iterable"" alwaysStopAt="true" /> | |
<variable name="VAR" expression="collectionElementName(ITERABLE)" defaultValue=""item"" alwaysStopAt="true" /> | |
<context> | |
<option name="Python" value="true" /> | |
</context> | |
</template> | |
<template name="fori" value="for $INDEX$, $VAR$ in enumerate($ITERABLE$): $END$" description="Iterate (for ... in enumerate)" toReformat="false" toShortenFQNames="true"> | |
<variable name="ITERABLE" expression="pyIterableVariable()" defaultValue="" alwaysStopAt="true" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import atexit | |
from pyVim.connect import SmartConnectNoSSL, Disconnect | |
import pyVmomi | |
from pyVmomi import vim | |
from typing import List, Dict, Union | |
from tabulate import tabulate | |
from getpass import getpass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Insert new variable": { | |
"prefix": ": ", | |
"body": [ | |
": \"{{ ${2:value} }}\"$0" | |
], | |
"description": "Insert new ansible variable" | |
}, | |
"Insert conditional list": { | |
"prefix": "cond", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Media; | |
using System.Windows.Media.Imaging; | |
namespace ZipImageViewer | |
{ | |
public class DpiImage : Image | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git checkout --orphan latest_branch # orphan omits all the history | |
git add * # if you want to include all files (respecting gitignore). Otherwise make other changes here. | |
git commit -am "commit message" | |
git branch -D master # delete master branch | |
git branch -m master # rename current branch to master | |
git push -f origin master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Get CDP information from one or more ESX hosts. | |
.PARAMETER VMHost | |
VMHost can be a list of the below entries: | |
- FQDN name of the host | |
- VMware.Vim.HostSystem (return type of 'Get-View -ViewType HostSystem') | |
- VMware.VimAutomation.ViCore.Impl.V1.Inventory.VMHostImpl (return type of 'Get-VMHost') |
OlderNewer