Skip to content

Instantly share code, notes, and snippets.

View fherbine's full-sized avatar
🏠
Working from home

Félix Herbinet fherbine

🏠
Working from home
View GitHub Profile
@fherbine
fherbine / clean-js
Last active March 21, 2020 20:10
Useful to remove all JS scripts from a web page
#!/usr/bin/python3
import datetime
import sys
from hashlib import md5
import requests
import sh
from bs4 import BeautifulSoup
<!-- Personnal exercise based on Derek banas work - https://www.youtube.com/watch?v=zeTPUdhfJOk -->
<!DOCTYPE html>
<html>
<head>
<title>Meteo</title>
<meta charset="utf-8">
</head>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script>
var api_uri = "https://www.prevision-meteo.ch/services/json/"
@fherbine
fherbine / french_cat_ai.py
Created June 19, 2020 11:35
Reproduction (in french) of an exercise in: NLP - Crash course AI
""" French cat AI.
This code is inspired from crash course AI about NLP:
https://www.youtube.com/watch?v=oi0JXuL19TA
"""
__author__ = 'fherbine'
import requests
@fherbine
fherbine / asynchronous_s3.py
Last active October 20, 2023 11:30
Download/upload asynchronously files from/to S3 bucket
import os
import queue
import threading
import time
import boto3
class AsynchronousS3:
"""Download/Upload asynchronously files from/to AWS S3 bucket.
@fherbine
fherbine / pystd.py
Last active September 9, 2020 08:29
Check if a module is whether standard or not + version checking
import sys
from importlib import import_module
from pip.commands.list import get_installed_distributions as get_modules
MODULES = get_modules()
if __name__ == '__main__':
module_name = sys.argv[-1]
tmp_path = sys.path
@fherbine
fherbine / POC_http_server_socket.py
Last active January 27, 2021 22:49
[Proof Of Concept] Low-level HTTP requests handling with python sockets.
import datetime
import json
HTTP_VERSION = '1.0'
HTTP_STATUS_CODES = {
200: 'OK',
201: 'CREATED',
202: 'ACCEPTED',
204: 'NO CONTENT',
400: 'BAD REQUEST',
@fherbine
fherbine / sem_sysV.c
Last active April 28, 2023 12:58
[Proof Of Concept] IPCc in C
/*
* HOW TO USE ?
*
* 1. Compile the program using `gcc sem_sysV.c`
* 2. Start the processes one by one
* 3. You'll see that only one process will enter the "main loop"
* 4. if you want another process to enter the loop, you must kill the process that is running the loop.
*
*/
@fherbine
fherbine / ft_ping_poc.c
Last active October 21, 2021 11:39
42 project POC
/*
* ft_ping 42 project POC.
*
* Date: 2021-10-21
*
* How to compile:
* clang -Wall -Wextra -Werror path/to/this/script.c
*
* How to run:
* ./a.out <ip adress>
@fherbine
fherbine / nm_poc.c
Created October 20, 2022 14:44
POC for 42 subject: nm
/* exit */
#include <stdlib.h>
/* close, fstat */
#include <unistd.h>
/* open, fstat */
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@fherbine
fherbine / shm_sysV.c
Created April 28, 2023 13:00
IPC shared memory Proof Of Concept
/*
* HOW TO USE ?
*
* 1. Compile the program using `gcc shm_sysV.c`
* 2. Start the master process by typing `./a.out "Any string of your choice"`
* 3. Finally, you can visualize the shared buffer of memory by starting another process
* without any arguments: `./a.out`.
* 4. When you're done you can kill the master process and free the memory (Ctrl+C)
*
*/