Skip to content

Instantly share code, notes, and snippets.

View glegoux's full-sized avatar
💻

Gilles Legoux glegoux

💻
View GitHub Profile
@glegoux
glegoux / master-iasd-session.md
Last active February 10, 2023 07:37
master-iasd-session
#Session PySpark's tutorial Duration Location
1 Spark Core > RDD API 3h In-person
2 Spark SQL > DataFame API 3h In-person
3 Predict the next movies seen (1) 3h In-person
4 Predict the next movies seen (2) 3h Virtually
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@glegoux
glegoux / install-git-centos.md
Last active January 25, 2021 13:55
[Bash] Install git without sudo locally for the user on CentOS

First check your version of CentOS:

$ cat /etc/redhat-release
CentOS Linux release 7.8.2003 (Core)

Now download a rpm package for Git from official mirror of CentOS in your home folder:

@glegoux
glegoux / op-any-digit-bases.bash
Last active June 6, 2020 14:29
[Bash] Do an operation + or - in base 2, 8, 10 or 16.
#!/usr/bin/env bash
#
# Do an operation + or - in base 2, 8, 10 or 16.
base=${1:-10}
n1="$2"
op=${3:--}
n2="$4"
if echo "${base}" | grep " " && ! echo "2 8 10 16" | grep "${base}"; then
@glegoux
glegoux / md-github-pages-to-pdf.sh
Created September 17, 2019 00:38
[Bash] Convert markdown wiki pages of GitHub to pdf
#!/usr/bin/env bash
#
# Convert markdown wiki pages of GitHub to pdf
# 1. Clone wiki project and then go to folder
# 2. Convert to pdf
pandoc --extract-media=. -f markdown_github -o pages.pdf *.md
xdg-open pages.pdf
@glegoux
glegoux / wireshark.bash
Created October 2, 2018 20:15
[Bash] Install and configure wireshark on Ubuntu
#!/usr/bin/env bash
sudo apt -y install wireshark
sudo dpkg-reconfigure wireshark-common
# run wireshark without sudo
# add current user in wireshark group
sudo usermod -a -G wireshark $USER
gnome-session-quit --logout --no-prompt
@glegoux
glegoux / b64-to-img.sh
Last active June 25, 2018 21:55
[Bash] Convert base 64 to image PNG and create image file
#!/usr/bin/env bash
cd $(dirname "$0")
file_b64="$1"
image_file="${2:-image.png}"
cat "${file_b64}" | base64 -d > "${image_file}"
@glegoux
glegoux / img-to-b64.sh
Last active June 25, 2018 21:53
[Bash] Convert image PNG to base 64 and copy
#!/usr/bin/env bash
cd $(dirname "$0")
img_file="$1"
# data:image/png;base64,<content base 64>
# data:image/svg+xml;base64,<content base 64>
base64 -w 0 "${img_file}" | xclip -selection c
@glegoux
glegoux / impot.py
Last active June 13, 2018 19:57
[Python] Compute french taxes in euro
#!/usr/bin/env python3
#
# Compute french taxes in euro.
#
# usage:
# python3 impot.py <yearly_gross_salary>
TAXE_SLICES = [(9710, 0.14), (26818, 0.30), (71898, 0.41), (152260, 0.45)]
def get_taxe_amounts_per_slice():
@glegoux
glegoux / screen-physical-size.py
Created June 13, 2018 19:50
[Python] Get screen physical size
#!/usr/bin/env python3
import subprocess
r = 1
screens = [l.split() for l in
subprocess.check_output(["xrandr"]).decode("utf-8").strip().splitlines()
if " connected" in l]