Let’s git

Posted by in Lagom

cd .../myproject/
nano -w .gitignore (filtered stuff, one on each row, *.old, *.backup etc)
git init
git add .
git commit -m "Initial release or whatever."
git status
nano -w
git diff
git add
git commit -m "Fixed a bug or whatever."
git push (if remote repository on gitlab etc.)

MariaDB and MySQL database backup

Posted by in Lagom

mysqldump -u USER -pPASSWORD --single-transaction --quick --skip-lock-tables --ignore-table=DATABASE.some_table DATABASE | gzip > "$(date +"%Y-%m-%d_%H-%M-%S").sql.gz"

Minimal PHP Curl Example

Posted by in Lagom

$curl = curl_init('');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($curl);
echo $data;

Create a Slackware kernel (initrd) for Hyper-V

Posted by in Lagom

If you are installing Slackware, after setup is done and before reboot, first chroot into the root partition:
# mount -t ext4 /dev/sda1 /mnt
# mount -o bind /proc /mnt/proc
# mount -o bind /dev /mnt/dev
# mount -o bind /sys /mnt/sys
# chroot /mnt

# mkinitrd -c -f ext4 -r /dev/sda1 -m hv_vmbus:hv_storvsc:mbcache:jbd2:ext4 -u -o /boot/initrd.gz -k

-r = boot partition
-k = kernel version

edit /etc/lilo.conf (or grub, elilo.conf etc) to match new initrd and generic kernel:

# nano -w /etc/lilo.conf

image = /boot/
append = "elevator=noop"
initrd = /boot/initrd.gz
root = /dev/sda1
label = hyperv

# lilo