Blog

  • podcast-hunt

    Podcast Hunt

    A clone of Product Hunt web built with MongoDB, Express and React.

    Available Scripts

    In the project directory, you can run:

    yarn start

    Runs the app in the development mode.
    Open http://localhost:3000 to view it in the browser.

    yarn test

    Launches the test runner in the interactive watch mode.\

    yarn build

    Builds the app for production to the build folder.
    It correctly bundles React in production mode and optimizes the build for the best performance.

    The build is minified and the filenames include the hashes.
    Your app is ready to be deployed!

    yarn eject

    Note: this is a one-way operation. Once you eject, you can’t go back!

    If you aren’t satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

    Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

    You don’t have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

    Visit original content creator repository
    https://github.com/alexdevero/podcast-hunt

  • sapiens

    📚 Projet de Visualisation de données: “Sapiens – Une brève histoire de l’humanité” 🌍

    🔍 Contexte

    Jonathan a été profondément marqué par la lecture de Sapiens – Une brève histoire de l’humanité de Yuval Noah Harari. Ce livre fascinant, publié en 2011, retrace l’évolution humaine depuis le paléolithique (il y a environ 2,6 millions d’années) jusqu’à notre ère contemporaine. Passionné par cette lecture, Jonathan a méticuleusement pris des notes détaillées qui serviront de base solide pour notre projet.

    📖 Les notes sont disponibles ici :

    🛠️ Description

    Notre démarche consiste à créer notre propre dataset au format JSON. Un exemple est disponible dans le fichier sapiens.json

    Type de données : Qualitatives ordinales.

    💻 Nous extrairons des données significatives du résumé de Jonathan – des informations simples mais essentielles pour comprendre l’histoire fascinante de notre espèce.

    🎯 Objectif

    Notre visualisation vise à expliquer et rendre accessible la riche histoire humaine présentée dans Sapiens. Plutôt que de rechercher des tendances ou d’explorer de nouvelles données, nous souhaitons organiser et synthétiser les moments clés du livre pour les présenter de manière claire et compréhensible.

    Face à l’abondance d’informations contenues dans l’ouvrage, nous avons décidé de les structurer visuellement pour une meilleure compréhension.

    🧠 Notre défi sera de maintenir un fil narratif cohérent tout en mettant en lumière les étapes cruciales qui ont façonné l’humanité. ⏳

    📊 Sources & Référence

    Nos données sont uniques, directement extraites du livre et soigneusement formatées en JSON par notre équipe. Ce format nous permettra de développer une visualisation efficace et percutante.

    Inspiration :

    📝 Wireframe

    Nous avons réalisé nos maquettes sur Figma en nous efforçant de créer des modèles haute fidélité, intégrant déjà les textes définitifs ainsi qu’un prototype fonctionnel (à l’exception de quelques fonctionnalités, comme l’effet de défilement). Voici les liens pour accéder à nos maquettes :

    Consignes du projet: GitHub COMEM-VisualDon

    Visit original content creator repository
    https://github.com/K-sel/sapiens

  • SSI2017

    SSI2017

    Adresses IP des machines

    • NETFILTER : 192.168.49.253
    • Réseau host only : VMNET4
    • Réseau bridge : VMNET2

    Initialisation de la machine virtuelle

    Faire un snapshot de l’état initial de la machine

    $addgroup debian sudo

    Déloger / loger

    $sudo apt-get install wireshark

    Choisir “Yes” pour utilisateur normal

        $sudo addgroup debian wireshark
        $sudo apt-get install openconnect
        $sudo apt-get install freerdp-x11
        $sudo openconnect dcloud-lon-anyconnect.cisco.com
        $sudo routel
    
    

    Dans une autre console :

        $ping  198.19.10.200
        $xfreerdp /u:administrator /p:C1sco12345 /v:198.19.10.1
    
    

    Présentation générale de l’infrastructure

    • Plan du réseau
    • Différents éléments

    Liste des machines

    Machines virtuelles présentes sur le réseau :

    • Client : machine client pour réaliser les tests
    • IPTable : firewall IPTable
    • ProxySyslog : machine “à tout faire” utilisée comme proxy et pour la gestion des logs (+ éventuellement DHCP et DNS)
    • Pfsense : Firewall PFSense
    • Onion : machine embarquant security onion

    Machines de base utilisées pour monter les machines du réseau :

    • DebianSSI-IMIE2017 : machine de référence utilisée en linked clone par Client + utilisée pour faire les tests dcloud
    • DebianSSI-IMIE-NoX : machine de référence utilisée en linkedclone par IPtable et ProxySyslog

    Réseau

    • Création d’un réseau Custom : vmnet4 / 192.168.49.0/24
    • Les machines IPTable et Pfsense ont une interface sur vmnet4 et une interface bridge sur le réseau externe
    • Les autres machines ont une interface sur vmnet4
    • Attention aux adresses réservées par VMWARE (gateway, host, dhcp, .1, .2, .254)

    Le réseau interne (VMNET4) est en 192.168.49.0/24.

    La plage DHCP est en 192.168.49.16/28

    • Address: 192.168.49.16
    • Netmask: 255.255.255.240 = 28
    • Wildcard: 0.0.0.15
    • Network: 192.168.49.16/28
    • Broadcast: 192.168.49.31
    • HostMin: 192.168.49.17
    • HostMax: 192.168.49.30
    • Hosts/Net: 14

    Les machines serveurs (IP fixes) sont dans le 192.168.49.224/27

    • Address: 192.168.49.224
    • Netmask: 255.255.255.224 = 27
    • Wildcard: 0.0.0.31
    • Broadcast: 192.168.49.255
    • HostMin: 192.168.49.225
    • HostMax: 192.168.49.254
    • Hosts/Net: 30

    Cf : http://jodies.de/ipcalc

    Firewall NETFILTER

    Il comporte 3 modules principaux :

    • IPRoute2 : embarque les fonctions de routage
    • Netfilter/IPtable : le firewall à proprement parler
    • L7Filter : les fonctions de filtrage aux niveaux applicatifs

    Les 4 modules interagissent dans une machine Linux pour produire un firewall relativement complet.

    Configuration du firewall NETFILTER

    Etape 1 : poser la machine sur le réseau

        $sudo addgroup <useraccount> sudo
        $apt-get install vim
        $vim /etc/network/interfaces
        allow-hotplug eth0
        iface eth0 inet static
            address 192.168.49.253
            netmask 255.255.255.0
        $cat /etc/resolv.conf
        $vim /etc/hostname
        NETFILTER
        $vim /etc/hosts
        127.0.1.1 NETFILTER
        $sudo service networking restart
    

    Tester ensuite le ping vers l’extérieur et le ping depuis le client se trouvant sur le réseau host only.
    Les deux doivent être OK.

    Etape 2 : activer le routage, mettre en place le NAT

    Activer le routage :

      $sudo vim /etc/sysctl.conf
      net.ipv4.ip_forward=1
    

    Activer le NAT

    • eth1 : interface WAN
    • eth0 : interface LAN

    $sudo iptables -A FORWARD -i eth0 -j ACCEPT
    $sudo iptables -A FORWARD -o eth0 -j ACCEPT
    $sudo iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
    

    Vérification

    • Pinger depuis la station présente sur le réseau interne vers une IP externe
    • Lister les règles sur le firewal

    $sudo iptables -L -v
    $sudo iptables -t nat -L -v
    
    

    Etape 3 : protéger le firewall

    Bloquer l’ensemble du trafic destiné au firewall, sauf SSH et PING

    $sudo iptables -t filter -A OUTPUT -p icmp -j ACCEPT           
    $sudo iptables -t filter -A INPUT -p icmp -j ACCEPT                       
    $sudo iptables -t filter -A OUTPUT -p TCP --sport 22 -j ACCEPT            
    $sudo iptables -t filter -A INPUT -p TCP --dport 22 -j ACCEPT
    $sudo iptables -A OUTPUT -o lo -j ACCEPT
    $sudo iptables -A INPUT -i lo -j ACCEPT
    $sudo iptables -t filter -P INPUT DROP
    $sudo iptables -t filter -P OUTPUT DROP
    $sudo iptables -t filter -P FORWARD DROP
    

    Firewall PFSENSE

    • IP LAN : 192.168.49.252
    • Plage DHCP : 192.168.49.16/28

    Définir la machine

    • FreeBSD64
    • 2 interfaces réseau, une bridge, l’autre host only
    • 2 cores
    • 2048Mo de mémoire
    • Boot CDROM sur l’iso de Pfsense

    Poser le système sur la machine

    Booter la VM sur l’ISO d’installation

    1. Boot multi user : enter
    2. I
    3. Change keymap to FR/ISO => accept settings
    4. Quick and easy install : enter
    5. Enter (standard)
    6. Reboot

    Booter sur le disque de la machine + configurer

    1. Enter
    2. Vérifier l’attribution des interfaces réseau LAN et WAN
    3. Si interfaces réseau mal attribuées, choix 1) puis réattribuer les interfaces
    4. Choix 2) enter
    5. Laisser l’interface WAN en DHCP
    6. Configurer l’interface LAN :
    • IP : 192.168.49.252
    • Mask : 24
    • Enter (pas de gateway)
    • Enter (pas d’IPV6)
    • Enable DHCP : y
    • DHCP : 192.168.49.17 / 192.168.49.31
    • Revert to http : si y => choix entre http et https, si n => https uniquement : n

    Fin de la configuration réseau minimale, ouvrir un browser sur le réseau host only et poursuivre en allant à l’adresse : https://192.168.49.252

    • Login : admin
    • Password : pfsense

    Configurer le firewall depuis l’interface Web

    • Hostname : PFSENSE
    • Domain : local
    • Primary DNS Server : vide (conf DHCP WAN)
    • Secondary DNS Server : vide

    Ecran suivant

    • NTP server: inchangé (on reste sur celui de pfsense pour la démonstration)
    • Time zone : Paris

    Ecran suivant

    • WAN : on ne change rien

    Ecran suivant

    • LAN : on ne change rien

    Ecran suivant

    • cliquer sur le lien pour accéder à la configuration Web => affichage d’un dashboard system

    On arrête la machine et on fait un snapshot en préparation des étapes suivantes.

    Gestion des flux

    Contrôle de la configuration de base

    • Désactiver le DHCP intégré à l’outil de virtualisation (VMWARE)
    • Démarrer le PFSENSE
    • Démarrer un client sur le réseau host-only
    • Mettre le client en IP dynamique
      • Supprimer la configuration de eth0 dans /etc/network/interfaces
      • reboot (ou redémarrage ntwk et ntwk manager)
      • /sbin/ifconfig => ok lease dhcp 192.168.49.17
      • ping adresse IP externe => ok
      • traceroute adresse IP externe => le flux passe bien par le pfsense

    Chiffres

    MD5SUM

    Pour vérifier l’authenticité d’un fichier, la commande MD5SUM génère un hash du fichier. Il me semble que MD5 n’est pas sûr et qu’il peut y avoir des collisions.

    Exemple :

    $wget http://ftp.us.debian.org/debian/pool/main/o/openssh/openssh-server_7.4p1-7_i386.deb
    $md5sum openssh-server_7.4p1-7_i386.deb
    

    Comparer la valeur à la valeur affichée par debian sur son site

    Authentification SSH

    $ssh-keygen -t rsa -b 4096

    Visit original content creator repository
    https://github.com/mdautrey/SSI2017

  • Delog

    Delog

    A web visualiser for Log.

    Usage

    • Download Delog.js and include it to your page.
    • Make a div. (It must be position: relative and have a defined height for charts!)
    • Export your logs from Log
    • Use it like this:

    var elem = document.getElementById('total-wrapper');
    var latest = document.getElementById('latest-wrapper');
    var specific_el = document.getElementById('specific-wrapper');
    var log = new Delog('example/data.json', function() {
      log.total(elem, 60, {color: '#000', empties: true});
      log.query({sector: 'Writing', project: 'Delog'}, specific_el, 30, {color: '#000', empties: true});
      log.latest(elem, 5, ' ~ ');
      // other functions
    });

    API

    log.total(element, days, properties);

    Draws a one color chart of your total hours/day for the last days days.
    The properties JSON has two fields:
    color: the hex code of the colors of the bars
    empties: if true empty days are marked with a line

    log.overview(element, days, properties);

    Draws a colorful chart of your total hours/day for the last days days. The colors are the same as in Log or properties.color if not set.
    The properties JSON has two fields:
    color: the default color for the sectors without a set color
    empties: if true empty days are marked with a line

    log.query(query, element, days, properties);

    Draws a one color chart for a specific project/sector for the last days days.
    Query could contain a sector or/and a project field. If both are present, the entries having both will be counted.
    The properties JSON has two fields:
    color: the hex code of the colors of the bars
    empties: if true empty days are marked with a line

    log.sectors(element);

    Prints every sector with total hours, total logs and focus percentage.

    log.projects(element);

    Prints every project with total hours, total logs and focus percentage.

    log.days(element);

    Prints how many days have passed since the first log.

    log.latest(element, x, separator);

    Prints the x latest entries. The separator is a string which separates the different properties of the entry. The default separator is -.

    log.sector_colors(element, properties);

    Prints the palette of sectors. The properties JSON has only two fields:
    fontSize: the size of the font and of the square (which shows the color)
    block: if true the sectors will be printed under each other, otherwise in a line

    Visit original content creator repository
    https://github.com/kodedninja/Delog

  • polacode

    Polacode

    Note: The original project by Pine & Peng was abandoned, so I picked up it when it broke back in 2019.

    Modifications include:

    • Fixed when VS Code switched away from syntax-highlight-copy by default
    • Improved performace from inlining multiple files
    • Anton Palgunov added buttons for toggling transparency and shadow
    • PR’s are welcome!

    Original ReadMe

    Polaroid for your code 📸.

    MarketPlace Page

    usage

    By Pine & Peng from VS Code team. Happy Coding!

    Why?

    You have spent countless hours finding the perfect JavaScript grammar, matching it with a sleek-looking VS Code theme, trying out all the best programming fonts.

    You take three days porting over your theme before starting to use VS Code. You shell out $200 for italic cursive html attributes.

    The code has to look right.

    Seriously, why not just take a screenshot?

    • I like and care about the shadow, padding & rounded corner of macOS’s screenshot. I want an easy way to have those nice visuals for any selection of my snippet.
    • I want to hide errors, warnings, color decorators, folding markers, line numbers, scrollbar and minimap.
    • It generates something decent on Windows & Linux.

    Demo

    Nord + Input Mono

    demo1

    Monokai Pro + Operator Mono

    demo2

    Material Theme Palenight + Fira Code

    demo3

    Tip

    • When running out of horizontal space, try the command View: Toggle Editor Group Vertical/Horizontal Layout.

    Credit

    Thanks to @tsayen for making dom-to-image, which Polacode is using for generating the images.

    Thanks to Dawn Labs for making Carbon that inspired Polacode.

    Many color are taken from the elegant Nord theme by @arcticicestudio.

    Download button animation is made with Vivus.

    Contribution

    Contribution is extremely unwelcome. Please open an issue first so I can stop you from complicating the UX.

    License

    MIT

    Visit original content creator repository https://github.com/jeff-hykin/polacode
  • grub-cfg-mv

    grub-cfg-mv

    (C) Martin Väth (martin at mvath.de).
    This project is under the GPL-2 license.
    SPDX-License-Identifier: GPL-2.0-only

    A grub.cfg library/example for GRUB2

    The generator tool grub-mkconfig provided by GNU’s GRUB2 bootloader
    is far from being optimal for many purposes.

    It can be very hard to modify that generator tool to produce a reasonable
    configurable menu. Instead of modifying this script, I recommend
    to write the desired config directly into your boot/grub/grub.cfg
    and to load a “library” of convenient functions to use from your config.

    The provided boot/grub/grub-mv.cfg is such a library.
    It should be mostly self-explanatory, especially when you see how
    it is used in the provided boot/grub/grub.cfg.

    The latter assumes that there are two ext4 partitions (sda1 and sda2)
    and a further swap (suspend) partition (sda3), all on the first harddisk
    with an msdos partition table, the first two partitions containing
    two linux installations (one for 64 bit and one for 32 bit).
    The files /boot/bzImage, /boot/bzImage.previous and /boot/bzImage.debug
    are supposed to be symlinks to the current/previous/debugging kernel
    of the corresponding partition.
    If you compile/install the kernels with https://github.com/vaeth/kernel
    these symlinks will be updated automatically.

    No initramfs is supposed to be used – with the exception of
    /boot/intel-uc.img so that the kernel can update
    your processors microcode before starting (recommended).

    Read the grub documentation if you need initramfs for another purpose
    or other fancy configuration stuff.

    In the example configuration also some further tools (SMB boot manager
    and memtest) are supposed to be installed.

    Of course, it is not really expected that this is your partition layout:
    This is merily an example, and should be easy to modify.
    However, even if by accident you should have exactly the same layout,
    you have to modify the provided grub.cfg to set appropriate values
    for PARTUUID and UUID.

    Visit original content creator repository
    https://github.com/vaeth/grub-cfg-mv

  • yi-hack Home Assistant integration

    yi-hack Home Assistant integration

    Overview

    yi-hack Home Assistant is a custom integration for Yi cameras (or Sonoff camera) with one of the following custom firmwares:


    And make sure you have the latest version.

    This integration is available from the Lovelace frontend without the need to configure the devices in the file configuration.yaml The wizard will connect to your cam and will install the following entities:

    • ffmpeg cam with stream and snapshot capabilities
    • mqtt cam with the last frame saved during a motion detection event
    • mqtt binary sensor for status (connection)
    • mqtt binary sensor for motion detections: human, animal, vehicle, … (*)
    • mqtt binary sensor for sound detection (*)
    • mqtt binary sensor for baby crying detection (*)
    • media player entity useful to play Home Assistant standard tts service (*)
    • switches and selects to enable/disable some cam configuration
    • ptz service (*)
    • speak service (only available if you install the internal tts engine from here https://github.com/roleoroleo/yi-hack-utils)

    (*) available only if your cam supports it.

    If you configure motion detection in your camera and media source in your home assistant installation, you will be able to view the videos in the “Media” section (left panel of the main page).

    Dependencies

    1. Home Assistant
    2. Camera
      • MQTT enabled
      • Configured with MQTT Broker credentials
      • Default Topics configuration

    Installation

    (1) Copy the custom_components folder your configuration directory. It should look similar to this:

    <config directory>/
    |-- custom_components/
    |   |-- yi_hack/
    |       |-- translations/
    |       |-- __init__.py
    |       |-- binary_sensor.py
    |       |-- camera.py
    |       |-- config.py
    |       |-- config_flow.py
    |       |-- const.py
    |       |-- manifest.json
    |       |-- media_player.py
    |       |-- media_source.py
    |       |-- select.py
    |       |-- services.yaml
    |       |-- strings.json
    |       |-- switch.py
    |       |-- views.py
    

    (2) Restart Home Assistant

    (3) Configure device and entities:

    • Go to Settings -> Integrations
    • Click “Add Integration” in the lower-right corner
    • Select “Yi Cam with yi-hack” integration

    • Enter the settings to connect to the web interface of your cam: host, port, username, password and ffmpeg parameters

    • Confirm and wait for the wizard completion
    • Set the “Area” if you need it
    • Enjoy your cam

    Add the stream to lovelace

    If you want to add your live stream to lovelace, use this custom components: https://github.com/AlexxIT/WebRTC/

    And add a simple configuration like this:

    type: 'custom:webrtc-camera'
    entity: camera.yi_hack_m_XXXXXX_cam
    ui: true
    

    If you have the camer setup in the motionEye Addon you can display the stream with the following:

    type: picture-entity
    entity: camera.camera1
    

    The Adress to add the Cam to motionEye is visible on the “Home” webinterface page. In my case it was: rtsp://192.168.178.243/ch0_0.h264

    Add PTZ-Buttons to Dashboard (only if supported by the camera)

    Example for left movement

    type: button
    tap_action:
      action: call-service
      service: yi_hack.ptz
      target: {}
      data:
        movement: left
        entity_id: camera.yi_hack_v5_abb....
    icon: mdi:arrow-left-bold-circle-outline
    name: yicam_ptz_left
    

    Requirements

    This component requires MQTT integration to be installed. Please be sure you added MQTT to you Home Assistant configuration.

    If you want to browse mp4 files saved on your cam, add media source component to your home assistant installation. Add the linw below to your configuration file:

    # Example configuration.yaml entry
    media_source:
    

    DISCLAIMER

    I AM NOT RESPONSIBLE FOR ANY USE OR DAMAGE THIS SOFTWARE MAY CAUSE. THIS IS INTENDED FOR EDUCATIONAL PURPOSES ONLY. USE AT YOUR OWN RISK.

    Donation

    If you like this project, you can buy me a beer 🙂

    Click here or use the below QR code to donate via PayPal

    Visit original content creator repository https://github.com/roleoroleo/yi-hack_ha_integration