Skip to content

Instantly share code, notes, and snippets.

View ionescu77's full-sized avatar
🎯
Focusing

Răzvan Ionescu ionescu77

🎯
Focusing
View GitHub Profile
@cabal95
cabal95 / vm-backup.sh
Created July 25, 2015 17:53
I use this script to backup my QEMU/KVM/libVirt virtual machines. The script requires KVM 2.1+ since it uses the live blockcommit mode. This means the data in the snapshot disk is rolled back into the original instead of the other way around. Script does NOT handle spaces in paths.
#!/bin/bash
#
BACKUPDEST="$1"
DOMAIN="$2"
MAXBACKUPS="$3"
if [ -z "$BACKUPDEST" -o -z "$DOMAIN" ]; then
echo "Usage: ./vm-backup <backup-folder> <domain> [max-backups]"
exit 1
@gabrieljcs
gabrieljcs / lvm-cache-fedora.md
Last active March 23, 2024 13:33
Instructions to create an LVM cache for root in Fedora

LVM cache in Fedora

From the man-pages: "The cache logical volume type uses a small and fast LV to improve the performance of a large and slow LV. It does this by storing the frequently used blocks on the faster LV. LVM refers to the small fast LV as a cache pool LV. The large slow LV is called the origin LV. Due to requirements from dm-cache (the kernel driver), LVM further splits the cache pool LV into two devices - the cache data LV and cache metadata LV. The cache data LV is where copies of data blocks are kept from the origin LV to increase speed. The cache metadata LV holds the accounting information that specifies where data blocks are stored (e.g. on the origin LV or on the cache data LV). Users should be familiar with these LVs if they wish to create the best and most robust cached logical volumes. All of these associated LVs must be in the same VG."

Assuming LVM is already setup in HDD (e.g. from anaconda) and SSD is untouched.

Create a physical

@elucify
elucify / gist:c7ccfee9f13b42f11f81
Created January 23, 2015 17:17
BASH: set variables for ANSI text color escape sequences
RESTORE=$(echo -en '\033[0m')
RED=$(echo -en '\033[00;31m')
GREEN=$(echo -en '\033[00;32m')
YELLOW=$(echo -en '\033[00;33m')
BLUE=$(echo -en '\033[00;34m')
MAGENTA=$(echo -en '\033[00;35m')
PURPLE=$(echo -en '\033[00;35m')
CYAN=$(echo -en '\033[00;36m')
LIGHTGRAY=$(echo -en '\033[00;37m')
LRED=$(echo -en '\033[01;31m')
@amirkdv
amirkdv / lv_rsync_backup.sh
Last active October 31, 2023 07:58
Backup an LVM logical volume via Rsync
#!/bin/bash
# Backup an entire LVM logical volume via a snapshot LV and rsync
[[ $( whoami ) != 'root' ]] && echo "sudo please" && exit 1
set -o errexit
set -o nounset
# LVM logical volume to backup
lv=book01
@mgedmin
mgedmin / StartSSL.md
Last active October 22, 2023 07:52
Free StartSSL.com SSL certificate HOWTO

How to get a free StartSSL.com SSL certificate

I'm writing this up from memory, so errors may appear.

This has been updated to use SHA256 certificates.

Start

  1. Go to http://www.startssl.com/
  2. Click on 'Control Panel'
@prudnikov
prudnikov / atomic_viewsets.py
Created December 17, 2019 09:55
Django Rest Framework Atomic ViewSet and Mixin.
from django.db import transaction
from rest_framework import mixins
from rest_framework.viewsets import GenericViewSet
__all__ = ['AtomicCreateModelMixin', 'AtomicUpdateModelMixin', 'AtomicDestroyModelMixin',
'AtomicModelViewSetMixin', 'AtomicModelViewSet']
class AtomicCreateModelMixin(mixins.CreateModelMixin):
@vees
vees / Lenovo Thinkcentre M92P.txt
Last active July 30, 2023 05:46
Ubuntu and UEFI on Lenovo Thinkcentre M92P
Lenovo Thinkcentre M92P
When booting to USB installer disk installation proceeds as expected
1962 no operating system found
When booting into preview mode all disks load without issue, so its not the cable
Secure Boot option either not present or disabled
Last time I fixed this by adding a fake line to the boot loader from instructions on the web
Got a warning during installation about UEFI mode
Windows Fast Startup disabled
jfly comment below:
@wfaler
wfaler / bind-consul.sh
Created September 9, 2015 19:01
use consul as DNS for local services, fronted by Bind for the rest
sudo apt-get install bind9 bind9utils bind9-doc
wget https://dl.bintray.com/mitchellh/consul/0.5.2_linux_amd64.zip
/etc/bind/named.conf.options:
options {
directory "/var/cache/bind";
recursion yes;
allow-query { localhost; };
forwarders {
@D4R4
D4R4 / l2tp_vpn_client
Created June 10, 2020 15:45
L2TP VPN Client setup on CentOS 7
Go step-by-step through following instructions to set up L2TP/IPSec VPN on Centos 7.
To set up the VPN client on centos 7, first install the following packages:
yum -y install epel-release
yum -y install strongswan xl2tpd
Create VPN variables (replace with actual values):
VPN_SERVER_IP='your_vpn_server_ip'
@tahmidsadik
tahmidsadik / purgeAndroid.txt
Created September 19, 2015 18:47
How to completely remove Android Studio from Mac OS X
How to Completely Remove Android Studio
Execute these commands from the terminal
rm -Rf /Applications/Android\ Studio.app
rm -Rf ~/Library/Preferences/AndroidStudio*
rm ~/Library/Preferences/com.google.android.studio.plist
rm -Rf ~/Library/Application\ Support/AndroidStudio*
rm -Rf ~/Library/Logs/AndroidStudio*