linner.org

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 changedfile.xxx
git diff changedfile.xxx
git add changedfile.xxx
git commit -m "Fixed a bug or whatever."
git push (if remote repository on gitlab etc.)
0

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"
0

Minimal PHP Curl Example

Posted by in Lagom

<?php
$curl = curl_init('https://www.google.se');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($curl);
curl_close($curl);
echo $data;
0

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 4.4.xxx

-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/vmlinuz-generic-4.4.xxx
append = "elevator=noop"
initrd = /boot/initrd.gz
root = /dev/sda1
label = hyperv
read-only

# lilo
0