docker

Dockerfile FROM gentoo/portage:latest as portage FROM gentoo/stage3-amd64:latest COPY --from=portage /var/db/repos/gentoo /var/db/repos/gentoo ENV ACCEPT_KEYWORDS="~amd64" \ EMERGE_DEFAULT_OPTS="--jobs=4 --quiet" \ FEATURES="-sandbox -usersandbox -ipc-sandbox -network-sandbox -mount-sandbox -pid-sandbox" \ MAKEOPTS="-j4" \ USE="" RUN emerge dev-vcs/git app-portage/repoman dev-util/pkgcheck \ && rm -rf /var/cache/distfiles/* Building the image From inside the my_build directory, we’ll use the docker build command, passing the -t flag to “tag” the new image with a name, which in this case will be my_image. The ....

VirtualBox

Shrink a vdi VirtualBox disk image Run defrag in the guest (Windows only) Nullify free space: With a Linux Guest run this: cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill With a Windows Guest, download SDelete from Sysinternals and run this: sdelete.exe c: -z Shutdown the guest VM Now run VBoxManage’s modifymedium command: On Linux: vboxmanage modifymedium disk /path/to/thedisk.vdi --compact Source: https://superuser.com/questions/529149/how-to-compact-virtualboxs-vdi-file-size Repack Windows DVD mkisofs \ -iso-level 4 \ -l \ -R \ -UDF \ -D \ -b boot/etfsboot....

Creating a new GPG key

Usefull options for .gnupg/gpg.conf # Suppress the initial copyright message no-greeting # Assume that command line arguments are given as UTF-8 strings utf8-strings # Always show long ID's and fingerprints keyid-format 0xlong with-fingerprint # Set what trust model GnuPG should follow trust-model tofu+pgp # The default key to sign with. If this option is not used, the default key is # the first key found in the secret keyring default-key 0xA06B003FC160B788 Create key and disable AEAD gpg --full-gen-key ....

git

clean up git git reflog expire --expire=1.minute refs/heads/master git fsck --unreachable git prune git gc git maintenance run A simple way to create git repository on a server machine connecting via ssh Create a working copy repository First, create a new local git repository and add all files within this folder. cd ˜/workshop git init git add . git commit -m "initial repository creation" Create the bare repository Then we have to create a bare repository on the server side....

Using Xephyr

$ Xephyr -ac -screen 800x600 -reset :1 & -ac : Disables access control restrictions and allows to forward the session -screen : sets the resolution of the new X session. Set it according to your need. -:1 : This specifies that the new X session is display number “1“. Your current Display is most probably “0“ -reset: Resets the X server when the last X client is closed. The Xephyr should start and you will get a blank new window....

Unzipping a problematic archive

Nice little tip for unzipping problematic archives (.zip) from AskUbuntu.com. I downloaded a .zip archive and could not for the life of me unzip. I tried gunzip and unzip – both failed with the following errors: Gunzip $ gunzip foo.gzip gzip: foo.gzip: unknown suffix -- ignored Unzip $ unzip foo.zip Archive: foo.zip End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive....

Config

Boot Kernel Command Line On boot systemd activates (by default), the target unit default.target whose job is to activate services and other units by pulling them in via dependencies. To override the unit to activate, systemd parses its own kernel command line arguments via the systemd.unit= command line option. This may be used to temporarily boot into a different boot unit. The classical run-levels are replaced as following: systemd.unit=rescue.target is a special target unit for setting up the base system and a rescue shell (similar to run level 1) systemd....

Commands

replace symlinks for i in *; do link=$(readlink $i) && rm $i && mv $link $i; done permissions find /home/user -type d -print0 | xargs -0 chmod 0775 find /home/user -type f -print0 | xargs -0 chmod 0664 clean up dconf For a single key: dconf reset "/path/to/the/key" Must not end with a /. For a whole path: dconf reset -f "/path/to/the/path/" Must end with a /. If you do this while having dconf-editor opened, it will likely crash....

systemd-nspawn

Downloading the Stage Tarball: mkdir /var/lib/machines/gentoo-stage3-amd64 && cd /var/lib/machines/gentoo-stage3-amd64 wget https://gentoo.osuosl.org/releases/amd64/autobuilds/current-stage3-amd64-systemd/stage3-amd64-systemd-*.tar.xz tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner Config file: gentoo-stage3-amd64.nspawn [Exec] Boot=1 PrivateUsers=off [Files] BindReadOnly=/var/db/repos BindReadOnly=/usr/src Bind=/var/cache/distfiles Bind=/var/cache/binpkgs Bind=/var/tmp/portage Set password: systemd-nspawn --settings=no -D /var/lib/machines/gentoo-stage3-amd64 passwd exit Boot and update: systemd-nspawn --machine=gentoo-stage3-amd64 emerge --metadata emerge --deep --newuse --update --ask --jobs 4 @system emerge app-shells/bash-completion systemctl poweroff make.conf PORTAGE_TMPDIR="/var/tmp" ACCEPT_LICENSE="* -@EULA" MAKEOPTS="-j8 -l9" EMERGE_DEFAULT_OPTS="--with-bdeps=y --ask --jobs=8 --load-average=9 --verbose --getbinpkg" chroot mount --types proc /proc /mnt/gentoo/proc mount --rbind /sys /mnt/gentoo/sys mount --make-rslave /mnt/gentoo/sys mount --rbind /dev /mnt/gentoo/dev mount --make-rslave /mnt/gentoo/dev chroot /mnt/gentoo /bin/bash env-update source /etc/profile export PS1="(chroot) $PS1" to install/update grub: mount /boot in chroot!...