Skip to content

Instantly share code, notes, and snippets.

View Bosek's full-sized avatar

Tomas Bosek Bosek

  • Ostrava, Czech republic
View GitHub Profile
@lassoan
lassoan / FillHolesInSegments.py
Last active February 4, 2024 18:54
Fills all internal holes inside segments. For example, fills in empty regions inside vertebral bodies segmented with Grow from seeds with intensity-based masking.
segmentationNode = slicer.mrmlScene.GetFirstNodeByClass('vtkMRMLSegmentationNode')
# set value to the size of the larges cracks in the segment surfaces
maximumHoleSizeMm = 2.0
############
masterVolumeNode = segmentationNode.GetNodeReference(segmentationNode.GetReferenceImageGeometryReferenceRole())
# Create segment editor to get access to effects
segmentEditorWidget = slicer.qMRMLSegmentEditorWidget()
# To show segment editor widget (useful for debugging):
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution
Last active May 6, 2024 14:11
Fix DNS resolution in WSL2
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@stalniy
stalniy / custom-pick.js
Created January 16, 2019 20:13
Custom pick with support for arrays using asterisk
function get(object, path) {
const fields = Array.isArray(path) ? path : path.split('.')
let cursor = object
for (let i = 0; i < fields.length; i++) {
if (fields[i] === '*') {
// TODO: validation of cursor being an array
const newPath = fields.slice(i + 1)
return cursor.map(item => get(item, newPath))
} else {
@rajibdpi
rajibdpi / Auto-Start a Virtual Machine at XenServer and XCP-NG Server 7.X.md
Last active May 3, 2023 15:09
Auto-Start a Virtual Machine at XenServer and XCP-NG Server 7.X.md

Auto-Start a Virtual Machine at XenServer and XCP-NG Server 7.X.md December 1, 2018 by Rajib Ahmed Enable auto-start on XenServer and XCP-NG Server:

# xe pool-list

output like this:
uuid ( RO) : XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX copy the UUID and use:

@MichaelPote
MichaelPote / himawari.ps1
Created February 3, 2016 19:11
Windows Powershell Script to download the latest image from the Himawari-8 satelite, combine the tiles into a single image, convert to jpg and then set as the desktop background.
#
# Himawari-8 Downloader
#
#
#
# This script will scrape the latest image from the Himawari-8 satellite, recombining the tiled image,
# converting it to a JPG which is saved in My Pictures\Himawari\ and then set as the desktop background.
#
# http://himawari8.nict.go.jp/himawari8-image.htm
#