Skip to content

Instantly share code, notes, and snippets.

View gmolveau's full-sized avatar

Grégoire MOLVEAU gmolveau

View GitHub Profile
@gmolveau
gmolveau / docker_quick_run.sh
Last active March 12, 2025 14:53
Quickly run a temporary docker container and execute bash to try things (like a CI script)
docker run --rm -it -v $PWD:/tmp debian:10-slim /bin/bash
# --rm : remove after exit
# -it : interactive TTY
# -v : mount folder : current folder to /tmp folder of the container
# debian:10-slim : docker image https://git.io/JJzfy
# /bin/bash : run bash in this container
@gmolveau
gmolveau / cron_sudo.md
Last active July 28, 2020 09:45
Run a script periodically with cron and sudo

inspiration (and concrete example) : https://kevq.uk/how-to-backup-nextcloud/

  • creating the dedicated user
# Create new user
sudo adduser <GOOD_LOGICAL_USERNAME>

if this user needs to store some data :

@gmolveau
gmolveau / watch_remote_git_repo.md
Last active July 27, 2020 14:15
Watching a remote git repository - checking if new commits available

Watch a remote git repo

In a folder :

  • copy this script in a file watch.sh :
#!/usr/bin/env bash
set -euo pipefail
@gmolveau
gmolveau / Activate Office 2019 for macOS VoL.md
Created July 5, 2020 17:11 — forked from zthxxx/Activate Office 2019 for macOS VoL.md
crack activate office on mac with license file

Activate MS Office 2019/2016 for macOS - Microsoft_Office_2019_VL_Serializer

Office 2019 above

2019-06-03

Note that Office2019 DO NOT support activate via simple copy/paste plist license file which is the simplest way to activate Office 2016. Fortunately, you can also use the VL Serializer tool, just install Office 2019 and Serializer, then run Serializer to activate.

Ref

@gmolveau
gmolveau / parallel.sh
Created July 2, 2020 21:04
todo parallel commands
cat urls.txt | xargs youtube-mp4 {}
cat urls.txt | xargs zsh -c 'youtube-mp4 {}'
cat urls.txt | xargs $functions[youtube-mp4] {}
cat urls.txt | xargs zsh -c '$functions[youtube-mp4] {}'
cat urls.txt | parallel curl http://example.com/item/{}.tar ">" {}.tar
@gmolveau
gmolveau / usb-automount.sh
Last active January 7, 2024 17:56
ubuntu server automount usb hard drive exfat
sudo fdisk -l
sudo blkid
# note the UUID
# create the folder where you want the USB drive to be mounted
sudo mkdir -p /media/usb
# if your USB drive is in exfat
sudo apt install exfat-fuse exfat-utils
@gmolveau
gmolveau / samba_guest.md
Last active July 1, 2020 21:08
ubuntu server / raspberry pi guest samba share folder/USB hard drive over network
  • Install samba :
sudo apt install samba samba-common-bin
  • Create folder if necessary :
mkdir -p /media/usb/NAS
@gmolveau
gmolveau / .gitlab-ci.yml
Last active July 29, 2020 13:46
Run gitlab-ci locally with or without docker
stages:
- build
localbuild:
image: debian:10-slim
stage: build
script:
- pwd
@gmolveau
gmolveau / twitter_medium_find.md
Last active July 10, 2020 13:23
Bookmarklet medium blogpost/article find URL on twitter to remove paywall

This code redirects the current page to the find twitter page.
Works great with medium articles to bypass the paywall.

Add this code to a bookmark :

javascript:(function(){window.open("https://twitter.com/search?q="+document.location.href, '_blank')})()
@gmolveau
gmolveau / keep-alive-sudo.sh
Created June 17, 2020 20:24
Bash/shell script command keep-alive sudo until the command has finished
# Ask for the sudo password
sudo -v
# Keep-alive: update existing `sudo` time stamp until the command has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &