Skip to content

Instantly share code, notes, and snippets.

View glegoux's full-sized avatar
💻

Gilles Legoux glegoux

💻
View GitHub Profile
@glegoux
glegoux / template.html
Last active May 10, 2016 20:27
Template HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Page Title</title>
<meta name="description" content="Ma description" />
<!-- -CSS -->
<link rel="stylesheet" href="file.css">
<style type="text/css">
p {
@glegoux
glegoux / mongo-version.sh
Last active May 10, 2016 20:28
[Documentation] Mongo Version
# Check that your MongoDB Server and your MongoDB Client are the same.
# MongoDB Server (daemon mongod)
$ mongod --version
# Or mongo then :
# > db.version()
# or
# > db.serverStatus().version
# MongoDB Client (processus mongo, your MongoDB Shell)
@glegoux
glegoux / slides-to-pdf.bash
Last active October 22, 2016 20:08
[Bash] Transform slides to pdf file
#!/usr/bin/env bash
rows=$1
columns=$2
pdfname=$3
# There are ${rows}x${columns} slides per pdf page.
# Create a new pdf file <name>-nub.pdf in the current folder for pdfname=<name>.pdf
pdfnup --no-landscape --a4paper --nup ${columns}x${rows} ${pdfname}
#!/usr/bin/env bash
#
# reset-filesystem-permission.bash
#
# Reset permission of current directory only files, subfolders and current folder
# from umask.
#
# /!\ This action can be hard to reverse, please use that with precaution.
# Change files permission
@glegoux
glegoux / do-not-suspend-on-lid-closure.txt
Last active July 27, 2017 21:35
[Text] Do not suspend computer after closing laptop lid on Linux.
Open the /etc/systemd/logind.conf file in a text editor as root, for example,
sudo -H gedit /etc/systemd/logind.conf
Add a line HandleLidSwitch=ignore (make sure it's not commented out!),
Restart the systemd daemon with this command:
sudo restart systemd-logind
@glegoux
glegoux / rename_files.bash
Last active July 27, 2017 21:56
[Bash] Rename several files
#!/bin/bash
for filename in `ls -1 | grep -E .mp4$\|.wmv$\|.ogv$`; do
ext="${filename##*.}"
name="${filename%.*}"
mv "${name}.${ext}" "${name}_v1.${ext}"
done
@glegoux
glegoux / manipulate-jar.bash
Last active August 10, 2017 15:00
[Bash] Manipulate JAR (Java ARchive) file with extension .jar
#!/usr/bin/env bash
usage() {
cat << EOF
usage: `basename "$0"` jar_name [file_name]
See content of archive jar, then content of a file if precised.
EOF
exit 1
}
@glegoux
glegoux / pdf-to-booklet.bash
Last active August 25, 2017 07:34
[Bash] Convert document pdf with A4 format as a booklet with A5 format
#!/usr/bin/env bash
#
# pdf-to-booklet.bash
#
# Convert document pdf with A4 format as a booklet with A5 format.
# A output/ folder will be created in the current directory containing:
# - input.pdf : original modified pdf document (with blank pages, to have a
# number of pages which is a multiple of 4).
# - output.pdf : booklet
#
@glegoux
glegoux / compress-img.bash
Last active August 30, 2017 07:37
[Bash] Reduce images to send a batch of images by email for example
#!/usr/bin/env bash
#
# compress-img.bash
#
# Reduce size by 50% for each given image by copying that in
# a new folder ./compressed.
#
# You can reduce size or quality of each image, if you don't want,
# send a link to application where there are your images. And this
# script is usless for your use case.
@glegoux
glegoux / setup-ssh-key.md
Last active September 11, 2017 23:49
SSH key authentication for GitHub repository

1) Generate your pair of SSH keys:

ssh-keygen -t rsa -b 4096 -C "<email>@example.com"

Add a passphrase is better. Here your pair of keys:

  • private key: without extension (keep that secret only for you)
  • public key : with extension .pub (for everybody)