Skip to content

Instantly share code, notes, and snippets.

View gmolveau's full-sized avatar

Grégoire MOLVEAU gmolveau

View GitHub Profile
@gmolveau
gmolveau / leboncoin_export_favoris.md
Last active March 30, 2021 13:00
leboncoin.fr export liked/favorites via console js
var r = "";
[].forEach.call(document.getElementsByClassName("styles_ad__3wlgO"), function (el, i) {
	var link = el.children[0].href;
	var title = el.querySelector('a:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > p:nth-child(1)').title;
	var price = el.querySelector('a:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > span:nth-child(1) > span:nth-child(1)').innerText;
	r += (i+1 + ". " + title + " - " + price + " : " + link + "\n");
@gmolveau
gmolveau / measure_shell_startup_time.sh
Created January 10, 2021 22:16
check startup time of the shell
for i in $(seq 1 10); do /usr/bin/time $SHELL -i -c exit; done
@gmolveau
gmolveau / Dockerfile
Created January 8, 2021 16:03
Dockerized jenkins build docker images
FROM jenkins/jenkins:lts
# yes it runs as root, sadly the only way I found to make it work
USER root
RUN apt-get -qq update && apt-get -qq -y install curl && apt-get clean
RUN curl -sSL https://get.docker.com/ | sh
@gmolveau
gmolveau / linux_server_hardening.md
Last active January 10, 2021 22:03
My first 10 minutes on a linux server

My first 10 minutes on a linux server

# Update
sudo apt-get update
sudo apt-get upgrade -y

# Secure SSH

sudo nano /etc/ssh/sshd_config
@gmolveau
gmolveau / crud.html
Created December 15, 2020 07:09
crud html js jquery
<!DOCTYPE html>
<html>
<head>
<title>crud</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="jquery.min.js"></script>
</head>
<body>
<div id="1">
@gmolveau
gmolveau / golang_offline.md
Last active May 26, 2025 07:46
golang mod offline dependencies download

golang offline module dependencies download

Using go mod vendor

0 - With an existing module

  • copy go.mod and go.sum files from the offline PC to the internet PC

0bis - New module

@gmolveau
gmolveau / volume_backup.sh
Last active August 20, 2020 09:00
docker volume backup restore shell/bash script
#!/usr/bin/env bash
# install :
# sudo cp volume_backup.sh /usr/bin/volume_backup ; sudo chmod +x /usr/bin/volume_backup
set -o errexit # set -e
set -o nounset # set -u
set -o pipefail
# references :
@gmolveau
gmolveau / tree.sh
Created August 16, 2020 19:05
tree print with only ascii caracters and no caracter escape with backslash
tree -N --charset unicode
@gmolveau
gmolveau / apt-list.sh
Last active March 2, 2022 06:49
debian/ubuntu apt-get list installed top-level packages/apps only without dependencies
# source : https://unix.stackexchange.com/a/369653
# not a perfect solution but it helps
python3 -c "from apt import cache;manual = set(pkg for pkg in cache.Cache() if pkg.is_installed and not pkg.is_auto_installed);depends = set(dep_pkg.name for pkg in manual for dep in pkg.installed.get_dependencies('PreDepends', 'Depends', 'Recommends') for dep_pkg in dep);print('\n'.join(pkg.name for pkg in manual if pkg.name not in depends))"
@gmolveau
gmolveau / diff-so-fancy-install.sh
Last active October 8, 2024 04:13
ubuntu/debian diff-so-fancy install
LATEST_VERSION=$(curl -s https://api.github.com/repos/so-fancy/diff-so-fancy/releases/latest | grep -Po '"tag_name": "v\K[^"]*')
sudo curl -L -o /usr/local/bin/diff-so-fancy "https://github.com/so-fancy/diff-so-fancy/releases/download/v${LATEST_VERSION}/diff-so-fancy"
sudo chmod +x /usr/local/bin/diff-so-fancy