Skip to content

Instantly share code, notes, and snippets.

View dgdavid's full-sized avatar

David Díaz dgdavid

View GitHub Profile

In the context of verifying https://trello.com/c/lh0QdXbP/2737-1-verify-behavior-with-ptablefs-in-the-same-disk (internal link) it was needed to create a virtual disk with a filesystem and an empty partition table on it. Thanks to @wfeldt, I manage to prepare it following below steps:

  • With an Ext4 filesystem

    # Create a 10GB virtual disk
    dd if=/dev/zero of=~/virtual-disk-1 bs=1M count=10240
    # Create an Ext4 filesystem on it
    mkfs.ext4 -F ~/virtual-disk-1

Add an empty msdos partition table (kudos to @wfeldt)

@dgdavid
dgdavid / wireles_dialog_proposal
Created November 27, 2020 12:28
A proposal for the yast2-network wireless dialog
Network Card Setup
┌General──Wireless Specific──Address──Hardware─────────────────────────────┐
│ |
| Network ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ [Choose Network] |
| |
│┌Authentication──────────────────────────────────────────────────────────┐│
││ ||
|| Mode ▒WPA-PSK ("home")▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒↓ ││
││ Password ▒******▒ ││
││ ││

Executing YaST Firstboot with an specific resolution

Yesterday, a guy from docu team ask me for help executing YaST Firstboot in an specific resolution.

Well, I'm trying to make screenshots of the SAP wizard. (...) , so I only need to log in with ssh and execute /usr/lib/YaST2/startup/YaST2.Firstboot. That works so far.

However, the script doesn't allow me to change the screen/window size. I need my screenshots in 800x600. Unfortunately, the script doesn't know the -g/--geometry option that is known in YaST.

Any hints? 🙂

@dgdavid
dgdavid / btrfs_checker.rb
Last active January 30, 2019 13:55
Check if the given path is in a btrfs filesystem
require 'yast'
require 'yast2/execute'
require 'pathname'
# Returns if the given path is placed in a btrfs
#
# @param path [String, Pathname]
#
# @return [Boolean]
def btrfs_available_for?(path)
@dgdavid
dgdavid / working_with_functions_in_bash.sh
Last active September 18, 2018 11:52
Testing how to work with functions in a shell script
#!/usr/bin/env bash
function this_and_that_are_equals () {
this="me"
that="you"
if [ $this = $that ]; then
return 0
else
return 1
@dgdavid
dgdavid / get_version_id_from_os_release.sh
Last active September 18, 2018 11:42
Simple example of how to get the VERSION_ID from /etc/os-release in a shell script
#!/usr/bin/env bash
# See https://www.freedesktop.org/software/systemd/man/os-release.html
version_id=$(grep "^ID=" /etc/os-release | cut -d'=' -f2 | tr -d '"')
echo $version_id