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

At the time of writing GnuPG unfortunately defaults to a 1024 bit DSAkey as the primary with SHA1 as the preferred hash. Due to weaknessesfound with the SHA1 hashing algorithm Debian prefers to use keys thatare at least 2048 bits and preferring SHA2. The following instructionsprovide a guide to how to generate such a key and are based, withpermission, on a post to Ana’sblog. pub 4096R/6AA15948 2009-05-10 Key fingerprint = 7A33 ECAA 188B 96F2 7C91 7288 B346 4F89 6AA1 5948 uid Ana Beatriz Guerrero López <ana@ekaia....

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 bash-completition systemctl poweroff 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!...