Skip to content

Instantly share code, notes, and snippets.

@AnatomicJC
AnatomicJC / android-backup-apk-and-datas.md
Last active April 26, 2025 18:36
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

Note: This gist may be outdated, thanks to all contributors in comments.

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Don't hesitate to read comments, there is useful tips, thanks guys for this !

@AnatomicJC
AnatomicJC / xfs-dedup.md
Last active March 6, 2025 20:44
XFS reflinks deduplication with duperemove and fdupes
@AnatomicJC
AnatomicJC / xfs-write-cache.md
Last active January 2, 2025 15:59
XFS write-cache

/etc/systemd/system/xfs-write-cache.service

[Unit]
Description=Set XFS Write cache to write through

[Service]
Type=oneshot
User=root
Group=root
ExecStart=/usr/lib/systemd/system-sleep/xfs-write-cache
@AnatomicJC
AnatomicJC / check_cpu_load.md
Last active December 29, 2024 11:26
Check CPU load

Script Bash pour surveiller la charge CPU et redémarrer HAProxy

Voici un script Bash qui vérifie la charge CPU et redémarre le service HAProxy si la charge dépasse 85 % au moins 2 fois. Le script stocke les occurrences dans un fichier temporaire.

Script Bash

#!/bin/bash

# Chemin du fichier temporaire pour stocker les occurrences

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@AnatomicJC
AnatomicJC / zfs-docker.md
Last active December 14, 2023 00:33
ZFS and Docker

Create a dedicated ZFS docker pool with deduplication disabled in case of dedup enabled on your system:

zfs create -o mountpoint=/var/lib/docker -o dedup=off rpool/docker

Sometimes, you don't want ZFS for docker storage. ZFS can be sadly quite painful with Docker in Docker and similar scenarios. It might be best to avoid the problem by creating a volume in your ZFS pool, formatting that volume to ext4, and having docker use "overlay2" on top of that, instead of "zfs".

zfs create -s -V 30G rpool/docker

mkfs.ext4 /dev/zvol/rpool/docker

@AnatomicJC
AnatomicJC / protect_data.md
Last active September 1, 2023 19:05
Ansible callback plugin to hide sensitive data such as passwords from screen output

With the below settings, each variable content containing vault, pwd or pass will be obfuscated.

In ansible.cfg:

# Enable plugin
[defaults]
stdout_callback = protect_data

[callback_protect_data]
@AnatomicJC
AnatomicJC / prevent-desktop-lock.md
Created August 9, 2023 14:07
Prevent desktop lock or screensaver with PowerShell
Add-Type -AssemblyName System.Windows.Forms

$sleep = 240

$i = 0
while ($true) {
  $Pos = [System.Windows.Forms.Cursor]::Position
  if (($i % 2) -eq 0) {
 [System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point((($Pos.X) + 1) , $Pos.Y)
@AnatomicJC
AnatomicJC / fill-known-hosts.md
Created August 9, 2023 11:12
Ansible: Add keys to known host with ssh-keyscan
- name: Update ~/.ssh/known_hosts file
  hosts: all
  gather_facts: false
  become: false
  tasks:
    - name: Update ~/.ssh/known_hosts
      ansible.builtin.known_hosts:
        name: "{{ inventory_hostname }}"
 key: "{{ lookup('pipe', 'ssh-keyscan ' + inventory_hostname) }}"
@AnatomicJC
AnatomicJC / ansible-setup-with-mitogen.md
Last active February 19, 2023 17:12
Ansible 2.14.2 setup with mitogen

Create requirements.txt file:

ansible==7.2.0
ansible-lint==6.10.0
jmespath
dnspython
git+https://github.com/mitogen-hq/mitogen.git@a47b9f3631ba3c37bf0410c6a4960c3eec152454