How to resize a qcow2 disk image on Linux
This example takes olddisk.qcow2
and resizes it into newdisk.qcow2
,
extending one of the guest's partitions to fill the extra space.
/** Representa una respuesta JSON satisfactoria */ | |
interface ResponseOk<T = null> { | |
success: true | |
data: T | |
} | |
/** Representa una respuesta JSON errónea */ | |
interface ResponseFail<T = null> { | |
success: false | |
code: string|number |
/** Generate secure random string values in Javascript using cryto-random bytes */ | |
function randomHash (len) { | |
return Array.from( | |
window.crypto.getRandomValues(new Uint8Array(Math.ceil(len / 2))), | |
(b) => ("0" + (b & 0xFF).toString(16)).slice(-2) | |
).join("") | |
} | |
// Simple tests with various lengths |
This example takes olddisk.qcow2
and resizes it into newdisk.qcow2
,
extending one of the guest's partitions to fill the extra space.
olddisk.qcow2
use futures::StreamExt; | |
use std::error::Error; | |
use tokio; | |
use tokio::macros::support::Pin; | |
use tokio::prelude::*; | |
use tokio::time::{Duration, Instant}; | |
pub fn main() -> Result<(), Box<dyn std::error::Error>> { | |
let mut multi_threaded_runtime = tokio::runtime::Builder::new() | |
.threaded_scheduler() |
/** | |
* DISCLAIMER: | |
* The only intention of this "scraper script" is to serving as a backup tool for YOUR own content on Quora. | |
* Which means YOUR PUBLIC/PRIVATE content with YOU as author. | |
* So use this script under Quora Policy and Term conditions. https://www.quora.com/about/tos_archive | |
**/ | |
/** | |
* Dead simple Javascript browser scraper to backing up YOUR Quora content. | |
* Feel free to customize it to your needs. |
ls /var/cache/pacman/pkg/ | wc -l
# 13886
du -sh /var/cache/pacman/pkg/
# 61G /var/cache/pacman/pkg/
Given that your key has expired.
$ gpg --list-keys
$ gpg --edit-key KEYID
Use the expire command to set a new expire date:
export function slugify (text: string, separator = "-", ampersand = "and") { | |
const a = "àáäâèéëêìíïîòóöôùúüûñçßÿỳýœæŕśńṕẃǵǹḿǘẍźḧ" | |
const b = "aaaaeeeeiiiioooouuuuncsyyyoarsnpwgnmuxzh" | |
const p = new RegExp(a.split("").join("|"), "g") | |
return text.toString().toLowerCase() | |
// Replace whitespaces and underscores with single hyphens | |
.replace(/[\s_]+/g, separator) | |
// Replace special chars | |
.replace(p, (c) => b.charAt(a.indexOf(c))) |
Following command will get just the name of the first Docker service running (usually the last one deployed) of a list of N services with running/shutdown/etc status.
Format name: service_name.N.ID
docker service ps my_service_name \
--no-trunc --format="{{.Name}}.{{.ID}}/{{.DesiredState}}" | grep "Running" | cut -f1 -d "/" | head -n1
# my_service_name.1.abcd1v23ui456pyu7lx8k9fze
version: "3" | |
services: | |
telegraf: | |
image: telegraf:1.14-alpine | |
environment: | |
HOST_ETC: /hostfs/etc | |
HOST_PROC: /hostfs/proc | |
HOST_SYS: /hostfs/sys | |
HOST_MOUNT_PREFIX: /hostfs | |
volumes: |