Skip to content

Instantly share code, notes, and snippets.

View Abdelkrim's full-sized avatar

Abdelkrim from Brussels Abdelkrim

View GitHub Profile
@Abdelkrim
Abdelkrim / gist:7e1e326d7246786e75d842608aa1a7d8
Created June 29, 2024 15:42
delete venv, __pycache__, .next directories
import os
import shutil
def is_venv_directory(path):
"""
Check if the given path is a virtual environment directory.
"""
return (
os.path.isdir(path) and
(os.path.isfile(os.path.join(path, 'bin', 'activate')) or
@Abdelkrim
Abdelkrim / remove-venv-pycache-directories.py
Last active June 29, 2024 13:18
Python script removing venv directories on Windows & Linux and, __pycahce__ directories
import os
import shutil
def is_venv_directory(path):
"""
Check if the given path is a virtual environment directory.
"""
return (
os.path.isdir(path) and
(os.path.isfile(os.path.join(path, 'bin', 'activate')) or
@Abdelkrim
Abdelkrim / certbot_create_self_certificate_and_pem_to_pfx.sh
Created May 29, 2021 15:36
use certbot to generate a self signed certificate and convert a .pem into .pfx
#!/bin/bash
# https://dev.to/ope/securing-your-azure-web-app-with-let-s-encrypt-4g99
echo please indicate the domaine name i.e. alt-f1.be
read domain_name
# domain_name=betterop.alt-f1.be
sudo certbot certonly -d $domain_name --manual --preferred-challenges dns
@Abdelkrim
Abdelkrim / delete_files_from_kaggle_working_directory.py
Created May 20, 2020 11:01
remove files from kaggle directory : '/kaggle/working/'
# Author Abdelkrim Boujraf, ALT-F1 SPRL
import os
dir_to_delete = '/kaggle/working/'
with os.scandir(dir_to_delete) as entries:
for entry in entries:
file_to_delete = f"{dir_to_delete}{entry.name}"
if os.path.isfile(file_to_delete):
print(file_to_delete)
os.remove(file_to_delete)
@Abdelkrim
Abdelkrim / InheritedWidgetSample.dart
Created May 10, 2020 23:46
Flutter, inherited widget understood from a Inherited Widgets Explained - Flutter Widgets 101 Ep. 3 on YouTube
// see https://www.youtube.com/watch?v=Zbm3hjPjQMk
import 'package:flutter/material.dart';
class InheritedSettings extends InheritedWidget{
final SettingsSwitchesStatefulWidget settingsSwitchesStatefulWidget;
final TechnicalInfoSection technicalInfoSection;
InheritedSettings({this.SettingsSwitchesStatefulWidget, Widget child}): super(child: child);
@Abdelkrim
Abdelkrim / git-publish-more-than-one-repository.sh
Last active April 30, 2020 13:29
git: move project from one repository to another one (bitbucket, github, gitlab)
# copy a repository and its tags into a second, third repositoty
# (c) Abdelkrim Boujraf, http://www.alt-f1.be
# Imagine that your original repository is on bitbucket.org
git@bitbucket.org:alt-f1.be/data_visualization.git
# ADD REMOTE PUSH URL's for gitlab and github
# It will change the remote.origin.pushurl config entry.
# Now pushes will send to both of these destinations, rather than the fetch URL.
# https://gist.github.com/rvl/c3f156e117e22a25f242
@Abdelkrim
Abdelkrim / requirements.txt
Created April 26, 2020 17:17
Sphinx: required libraries
# store the file in the root of your sphinx repository
unidecode
Sphinx
sphinx-rtd-theme
sphinxcontrib-plantuml
# Docs
sphinxcontrib-httpdomain==1.4.0
# git lfs
@Abdelkrim
Abdelkrim / conf.py
Last active April 26, 2020 17:23
Sphinx: Read The Docs: git-lfs support. Add this piece of code at the beginning of the conf.py to support resources stored in git-lfs in readthedocs.org
# correct the issue : pdf generation fails after a 'libpng error: Not a PNG file'
# See https://github.com/readthedocs/readthedocs.org/issues/6770
# gist source: https://gist.github.com/Abdelkrim/c1d7005feccbcfa66b198151dc1c4abd
# -- manage git-lfs ----------------------------------------------------------
import os
if not os.path.exists('./git-lfs'):
os.system('wget https://github.com/git-lfs/git-lfs/releases/download/v2.7.1/git-lfs-linux-amd64-v2.7.1.tar.gz')
@Abdelkrim
Abdelkrim / LICENSE
Created February 20, 2020 13:25
ALT-F1.BE : template for a closed licensing of the software
Copyright (c) 2010-2020 Abdelkrim Boujraf (abo+license@alt-f1.be), ALT-F1 SPRL
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
@Abdelkrim
Abdelkrim / standard-version_package.json
Last active February 20, 2020 13:24
standard-version : add the package.json configuration including the scripts to manage the semver of your project AND generate the CHANGELOG
{
"name": "altf1bemanagesemver",
"description": "ALT-F1 SPRL: Empty package.json including the management of the semver",
"authors": "Abdelkrim Boujraf, ALT-F1 SPRL",
"version": "1.0.1",
"main": "build/html/index.html",
"scripts": {
"release": "standard-version",
"patch": "npm run release -- --release-as patch",
"minor": "npm run release -- --release-as minor",