Category: Blog

  • 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