Skip to content

Instantly share code, notes, and snippets.

View HugoPoi's full-sized avatar

Hugo Poissonnet HugoPoi

View GitHub Profile
@HugoPoi
HugoPoi / Resize virtual machine partition.md
Last active May 4, 2024 01:46
How to resize virtual machine partition after extend the disk

Resize a VM system disk

Introduction

  • You have a VM with small disk
  • You have GPT partition table
  • You NOT USE LVM (you should)
  • You need to extend a partition on the main drive
  • You use Debian 8.x aka Jessie

Extend the disk

@HugoPoi
HugoPoi / get_collections_sizes.js
Created January 30, 2019 16:21
MongoDB Get collections storage sizes in GB sorted
(() => {
let datas = [];
db.getCollectionNames().forEach(colName => {
let stats = db.getCollection(colName).stats();
datas.push({
colName,
size : stats.storageSize,
humanSize: (stats.storageSize / (1024*1024*1024)) + ' GB'
});
@HugoPoi
HugoPoi / oplog_estimate_per_collection.js
Created February 1, 2019 17:08
MongoDB get estimate oplog per collection with profiler
// https://docs.mongodb.com/manual/tutorial/manage-the-database-profiler/#enable-and-configure-database-profiling
(() => {
return db.system.profile.aggregate([
{ $match: { $or: [{op: {$in: ['update', 'insert', 'delete']}}, {'command.writeConcern': {$exists: true}}] } },
{ $group: {_id: {op : '$op', ns: '$ns', client: "$client"}, count: {$sum: 1}, start: {$min: "$ts"}, end: {$max: "$ts"} } },
{ $match: { count: { $gt: 50}}},
{ $sort: {count: -1} }
]).map((requestStats) => {
@HugoPoi
HugoPoi / Install Mastodon-Twitter Crossposter on Docker.md
Last active April 5, 2020 21:25
Install Mastodon-Twitter Crossposter on Docker

Setup on Docker

Start the stuff

  1. docker-compose up -d --build

Setup the db

  1. docker exec mastodon-twitter-poster_web_1 bundle exec rake db:setup ^ this crash because it assume you have psql localy and direct connection
  2. cat db/structure.sql | docker exec -i mastodon-twitter-poster_db_1 psql --user postgres --db mastodon_twitter_poster_production

Other usefull command

@HugoPoi
HugoPoi / sources.list
Created February 4, 2022 12:06
Default sources list Bullseye
deb http://deb.debian.org/debian bullseye main
deb-src http://deb.debian.org/debian bullseye main
deb http://security.debian.org/debian-security bullseye-security main
deb-src http://security.debian.org/debian-security bullseye-security main
deb http://deb.debian.org/debian bullseye-updates main
deb-src http://deb.debian.org/debian bullseye-updates main