Blog

  • books

    Books

    Introduction

    Prerequisites

    • Install all requirements on your machine
    • brew install graphviz
    • brew install imagemagick
    • brew install firefox (for running cucumber tests)

    Installation

    $ git clone https://github.com/kabisa/books
    $ cd books
    $ rbenv install `cat .ruby-version` # assuming you use rbenv.
    $ bundle install
    $ yarn install
    $ bin/rails db:setup
    

    Running / Development

    Populate the database

    The project comes with a seed.rb which you can use to populate your development environment:

    $ bin/rails db:seed [USERS_COUNT=n] [BOOKS_COUNT=m]

    Running tests

    $ bin/rails ci

    Technical details

    Class diagram

    erd.svg

    To update the diagram, run the following command:

    $ bin/rails erd

    Daemonite’s Material UI

    Since I never used Material Design before, I thought this project would make a good candidate. For this I used Daemonite’s Material UI, which uses Bootstrap with some customizations added to it. Instructions on how to use Daemonite’s Material UI in a Rails project can be found here.

    Font Awesome

    Font Awesome has a gem available for including FA in a Rails project. Instead this project used yarn for installing the FA package, since relies on the asset pipeline.

    I did copy the view helper from this gem and renamed it from icon to fa_icon

    SendGrid

    The production version of this application uses SendGrid for sending mails.

    S3

    In some environments images are uploaded to an S3 bucket using CarrierWave. If you want to use this feature, make sure you have an S3 bucket created and add the required keys to the corresponding ENV variables:

    • AWS_ACCESS_KEY_ID
    • AWS_SECRET_ACCESS_KEY
    • AWS_REGION
    • AWS_BUCKET_NAME

    Fallback cover image

    Generated using https://dummyimage.com/200×300/212121/fafafa.png&text=No+Cover+Available

    Deployment

    The application is hosted by Heroku (staging and production). Instruction about the deployment process can be found here.

    Build Status

    Visit original content creator repository https://github.com/kabisa/books
  • WeatherMate

    ☀️ WeatherMate

    WeatherMate est une application Android de prévisions météorologiques développée par Elliot Casna, Marc Bériot et Anne Passelègue dans le cadre de leur projet de fin de semestre pour le BUT2 informatique à l’IUT Lyon 1.

    L’objectif de l’application est de fournir des informations précises et à jour sur les conditions météorologiques actuelles et futures pour les utilisateurs.

    🚀 Fonctionnalités

    • Prévisions météorologiques en temps réel
    • Recherche de prévisions météorologiques pour les villes du monde entier
    • Affichage des températures maximales et minimales, de l’humidité, de la vitesse du vent et des conditions météorologiques actuelles
    • Interface utilisateur conviviale et facile à naviguer
    • Possibilité de choisir un emplacement géographique afin de connaitre les conditions météorologiques

    📦 Librairies utilisées

    WeatherMate utilise deux librairies open source pour fournir une expérience utilisateur optimale :

    • Lottiefiles : Une bibliothèque d’animations vectorielles pour Android, iOS et le web. Nous avons utilisé Lottiefiles pour ajouter des animations fluides à notre interface utilisateur et améliorer l’expérience utilisateur globale.
    • Retrofit : Une bibliothèque pour Android qui permet de faciliter l’accès aux API REST. Nous avons utilisé Retrofit pour interroger l’API de prévisions météorologiques et récupérer les données pour les afficher dans notre application.

    📝 Comment contribuer

    Nous apprécions toutes les contributions à WeatherMate, qu’il s’agisse de rapports de bugs, d’améliorations de fonctionnalités ou de pull requests. Si vous souhaitez contribuer, veuillez consulter notre guide de contribution dans le fichier CONTRIBUTING.md.

    📄 Licence

    WeatherMate est sous licence MIT. Veuillez consulter le fichier LICENSE pour plus d’informations.

    📞 Contact

    Si vous avez des questions, des commentaires ou des préoccupations concernant WeatherMate, n’hésitez pas à nous contacter à l’adresse e-mail suivante : weathermate.support@domain.com.

    Visit original content creator repository
    https://github.com/elliot-cx/WeatherMate

  • subtitles-like-udemy

    Subtitles like Udemy

    Imitación de subtitulos al igual que la plataforma de aprendizaje “Udemy”.

    Es solamente un demo de la simulación del mismo método de seguimiento de subtitulos, no tiene la sincronización de milisegundos, solo por segundos.

    Hay que realizarle muchas correcciones, pero solamente es un demo para motivos de aprendizaje, está a una gran distancia de la versión original.

    ¿Cómo puede servir para motivos de aprendizaje?

    Te puede servir para cargar videos de YouTube, descargar los subtitulos y practicar el ‘listening’, a medida que vas viendo el video se remarca el texto que se está reproduciendo, y cuando tengas dudas del qué pronunciaron puedas revisar los subtitulos, teniendo de ventaja que ya sabrás en qué lugar del texto observar.

    Puedes agregar Dictionary (Google™ Translate) Anywhere a tu navegador y si no sabes una palabra poder traducirla y agregarla a tu vocabulario.

    Espero te ayude en tu aprendizaje, ya que ése fué el motivo para realizarlo, facilitarme el aprendizaje y que otras personas también puedan usarlo. Compartelo si lo consideras adecuado y muchos más puedan beneficiarse.

    Si tiene fallas me disculpo de ante mano por la mala experiencia, algún día le agregaré mejoras.

    Intrucciones de uso

    • Visita el sitio subtitles-like-udemy
    • Dirigete a YouTube, copia el enlace del video seleccionado
    • Pega el enlace en el sitio subtitles-like-udemy en el campo de texto “Enter URL”
    • Presiona “Load”
    • Visita el sitio http://www.lilsubs.com/ y pega el enlace del video de YouTube para poder descargar el subtitulo
    • Regresa a subtitles-like-udemy y presiona “Load Subtitle”
    • Se mostrará una ventana donde puedes seleccionar el subtitulo descargado
    • El subtitulo se cargará y se remarcará según el video vaya avanzando

    Demo

    Subtitles like Udemy

    Visit original content creator repository https://github.com/moudev/subtitles-like-udemy
  • FiraMonoMz

    Download

    Image Fira Mono Mz

    This font is a derived work from Mozilla Fira.

    • In folder FiraMonoMz-ttf-g (recommended): font files with &, @ and g modified.

    • In folder FiraMonoMz-ttf: font files with & and @ modified

    License & Difference from Fira Mono

    This work is based on: Mozilla Fira Currently based on commit 5c8d9b.

    This work is not based on FiraCode. So Fira Mono Mz doesn’t support font ligatures (I personally don’t find it useful).

    Just like Fira Mono, this work is also free and open source, and the license is the same as Fira Mono.

    It changes following chars in Fira Mono:

    • &: use the design of & in open source font “Hack”

    • @: use the design of @ in open source font “Inconsolata”

    • g: slightly modify the shape, to seal the bottom part. This make the g char looks more readable and balanced in small font size.

    • Fira Mono Mz: Image Fira Mono Mz

    • Original Fira Mono: Image Fira Mono

    • char g comparison in small font size:
      char g comparison

    • char g comparison in large font size:
      char g comparison

    For font hackers

    We have 3 font-forge prject files:

    • FiraMonoMz-Bold.sfdir\: font-forge project file for font FiraMonoMz-Bold.
    • FiraMonoMz-Medium.sfdir\: font-forge project file for font FiraMonoMz-Medium.
    • FiraMonoMz-Regular.sfdir\: font-forge project file for font FiraMonoMz-Regular.

    Post-processing to make font be recognized as “Monospaced font”

    If you make some changes to the font-forge prject, remember that after exporting your version of .ttf file using font-forge, you need to run following commands:

    python fixmono.py FiraMonoMz-Regular.ttf
    python fixmono.py FiraMonoMz-Medium.ttf
    python fixmono.py FiraMonoMz-Bold.ttf
    
    python fixmono.py FiraMonoMz-ttf-g/FiraMonoMz-Regular-g.ttf
    python fixmono.py FiraMonoMz-ttf-g/FiraMonoMz-Medium-g.ttf
    python fixmono.py FiraMonoMz-ttf-g/FiraMonoMz-Bold-g.ttf

    What is done: the script set the isFixedPitch of each font to 1. (You might need to install fonttools python package first. See fixmono.py for detail.)

    See also: https://github.com/ryanoasis/nerd-fonts/blob/master/bin/scripts/fpfix.py

    why need post-preocessing

    See file 0 width glyph.log (which is the output of grep "^Width:" *.glyph > "../0 width glyph.log") for detail: search for keyword ‘Width: 0’, you can see 27 chars have 0 width.

    As a result, the font generated by font-forge will not set the isFixedPitch to 1, which makes some software couldn’t recognize the font as Monospaced font.

    See more about why font-forge do not automatically set isFixedPitch: http://fontforge.10959.n7.nabble.com/Regenerated-font-does-not-recognize-as-a-Monospace-in-Windows-td11291.html

    Visit original content creator repository https://github.com/zsh-89/FiraMonoMz
  • SE0352NQ01_Library

    SE0352NQ01 Library

    A library for the SE0352NQ01 e-paper display, driven by a Wisblock RAK4631 (nRF52840 + SX1262). It uses Adafruit GFX fonts for Latin characters, and a vaguely compatible format for Chinese, a subset of 2,500 characters anyway, based on micropython-font-to-py. After running

    python3 font_to_py.py -x -k cjk /path/to/font.otf 16 cjk16b.py

    I cleaned up cjk16b.py a little, and added code that produces the CJK16pt.h header file. This file can then be included into the Arduino project. The cjk subset file is included, so you can edit it and add/remove chars.

    #include <SE0352NQ01.h>
    // Include fonts from https://github.com/adafruit/Adafruit-GFX-Library/tree/master/Fonts
    #include "FreeSansBold12pt7b.h"
    #include "FreeSerifBoldItalic24pt7b.h"
    #include "CJK14pt.h"
    #include "CJK16ptB.h"

    API

        void sleep(void);
        void refresh(void);
        void send(unsigned char*);
        void send_DU(unsigned char*);
        void fill(unsigned char);
        void drawString(char *, uint16_t, uint16_t, GFXfont, uint8_t, unsigned char*);
        void drawUnicode(
          uint16_t*, uint8_t, uint16_t, uint16_t, unsigned char*,
          unsigned char*, uint16_t, uint8_t, uint8_t, unsigned char*
        );
        void drawBitmap(
          uint8_t, uint8_t, uint16_t,
          uint16_t, int8_t, int8_t, // these three only for fonts, not necessary for bitmap images
          uint16_t, unsigned char *, unsigned char *, uint8_t
        ); // fonts version
        void drawBitmap(
          uint8_t, uint8_t, uint16_t,
          uint16_t, unsigned char *, unsigned char *, uint8_t
        ); // bitmap images version
        uint16_t width(uint8_t); // returns width given the orientation
        uint16_t height(uint8_t); // returns height given the orientation

    The most important commands are drawString, drawUnicode, and drawBitmap. The first is for ASCII text, the second for Chinese (or other UTF16 codepoints for which you have produced a font), and the third one is for partial images: it is the same code for both images and individual characters, which are both horizontally-encoded bitmaps. I wrote separately a desktop application that creates full-size images, in the RAM buffer format the EPD expects, from pictures you pass it, and partial images encoded as horizontally-encoded bitmaps. These images are resizable with the Zoom slider, and the black-and-white threshold adjustable with the B/W Threshold slider.

    The drawString function returns the string’s width in pixels, which you can ignore. That is, you can do:

    SE0352.drawString((char*)"This is a test", 0, 34, FreeSansBold18pt7b, 0, frame);

    or

    uint16_t wd = SE0352.drawString((char*)"This is a test", 0, 34, FreeSansBold18pt7b, 0, frame);

    Note that if the string overflows the bottom of the screen (239 or 359 depending on orientation), drawString returns without completing, which means that the returned width will be incorrect. If you’re only interested in the string’s width, without drawing it, call strWidth().

    uint16_t wd = SE0352.strWidth((char*)"This is a test", FreeSansBold18pt7b);

    This does basically the same, without drawing anything. It will be accurate too, since the function won’t bail because of screen overflow.

    The send and send_GU commands send full-size images to the EPD, using either lut_GC() (full refresh) or lut_DU() (faster refresh that may leave shadows if used too often).

    Full-Size_Image

    Resized_Image

    This application, EPD Viewer, was made with Xojo, which is a paid development platform. I will release the code, but it’d require Xojo to compile it. I’ve added in the mean time a binary for Mac OS X, which is what I use. When I can test Linux and Windows version, I will release them too.

    Rotation

    There are 4 levels of rotation: 0 & 2 (Landscape), and 1 & 3 (Portrait). Rotation is passed to drawString, drawUnicode, and drawBitmap functions every time, so you can draw text in different rotations within the same screen. send and send_GU don’t have yet rotation enabled.

    Drawing

    I have added a few drawing primitives:

    • void setPixel(uint16_t x, uint16_t y, uint8_t rotation, uint8_t *buffer);
    • void clearPixel(uint16_t x, uint16_t y, uint8_t rotation, uint8_t *buffer);
    • void drawHLine(uint16_t x0, uint16_t y0, uint16_t x1, uint8_t rotation, uint8_t *buffer);
    • void drawVLine(uint16_t x0, uint16_t y0, uint16_t y1, uint8_t rotation, uint8_t *buffer);
    • void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t rotation, uint8_t *buffer);
    • void drawCircle(int xc, int yc, int r, uint8_t rotation, uint8_t *buffer);
    • void drawRect(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t rotation, uint8_t *buffer);
    • void fillCircle(int xc, int yc, int r, uint8_t rotation, uint8_t *buffer);
    • void fillRect(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t rotation, uint8_t *buffer);
    • void clearRect(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t rotation, uint8_t *buffer);
    • void drawPolygon(uint16_t * points, uint16_t len, uint8_t rotation, uint8_t *buffer)
    • void fillContour(uint16_t iXseed, uint16_t iYseed, uint8_t rotation, uint8_t *buffer);

    fillContour() works pretty well, but in some cases it may require more than one call. For example, in the image below, fillContour() had to be called twice for the narrow disk: I drew two circles a few pixels apart, then called fillContour() once on the left, and once on the right.

    Drawing_Functions

    • void partialRefresh(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint8_t rotation, uint8_t* buffer);

    partialRefresh is a bit finicky, but I got it to work pretty well. It too takes care of rotation.

    Code128

    By popular demand (right…) I have added creation and display of Code128 barcodes.

    • makeCode128(char *barcode, uint8_t wx, uint8_t bh, uint16_t px, uint16_t py, uint8_t rotation, uint8_t *buffer);

    Demo

    demo

    Code128

    Visit original content creator repository https://github.com/Kongduino/SE0352NQ01_Library
  • InconsistencyMasks

    Inconsistency Masks

    Generating sufficient labeled data is a significant hurdle in the efficient execution of deep learning projects, especially in uncharted territories of image segmentation where labeling demands extensive time, unlike classification tasks. Our study confronts this challenge, operating in an environment constrained by limited hardware resources and the lack of extensive datasets or pre-trained models. We introduce the novel use of Inconsistency Masks (IM) to effectively filter uncertainty in image-pseudo-label pairs, substantially elevating segmentation quality beyond traditional semi-supervised learning techniques. By integrating IM with other methods, we demonstrate remarkable binary segmentation performance on the ISIC 2018 dataset, starting with just 10% labeled data. Notably, three of our hybrid models outperform those trained on the fully labeled dataset. Our approach consistently achieves exceptional results across three additional datasets and shows further improvement when combined with other techniques. For comprehensive and robust evaluation, this paper includes an extensive analysis of prevalent semi-supervised learning strategies, all trained under identical starting conditions.

    PWC

    PWC

    PWC

    PWC

    Creation of an Inconsistency Masks

    IM_creation Creation of an Inconsistency Masks with two models: (a) & (b) binary prediction of model 1 and 2 after threshold, (c) sum of the two prediction masks (d) Inconsistency Mask (e) final prediction mask

    Inconsistency Masks usage

    IM_over_5_Generations IM is used to remove the uncertainty from the pseudo-label as well as from the input image. Here you can see the changes in an input image and the corresponding pseudo-label on the SUIM dataset for IM+ over all five Generations. Magenta represents reefs, black indicates background or waterbody, gray represents IM, blue for divers, yellow for fish, and turquoise for wrecks.

    Results

    Due to limited hardware resources and the scale of our study, which required training thousands of U-Nets, we could only use small datasets and train tiny U-Nets (0.17 – 2.72 million parameters) compared to modern ViTs. But the uniform training conditions across all approaches ensure that our findings are still comparable.

    main_results

    In this diagram, we focus on results that exceed those of Labeled Dataset Training (LDT) to avoid excessively compressing the representation of other outcomes. For a complete overview, a diagram with all results will be available in the appendix of the paper. The benchmarks used include Full Dataset Training (FDT), Labeled Dataset Training (LDT, randomly selected 10% of the complete dataset), and Augmented Labeled Dataset Training (ALDT, Labeled Dataset with 9 additional augmented versions of each image). The SSL approaches should surpass ALDT to justify their added complexity. Among common SSL approaches – Model Ensemble, Input Ensemble, Consistency Loss, and Noisy Student – all but Noisy Student proved to be of limited effectiveness.

    EvalNet: This approach, inspired by the ValueNet from the AlphaGo paper, to our knowledge, has not yet been used for image segmentation. EvalNet assesses the segmentation quality of pseudo-labels, using only those segmentation masks for training that exceed a set threshold in IoU/mIoU score.

    IM: Our novel approach demonstrates strong performance, consistently outperforming all other SSL methods across various datasets, particularly in the initial generations. The only exception is the Noisy Student method, which manages to match or surpass IM after four Generations in ISIC 2018, albeit with approximately six times more parameters.

    Combination Approaches: IM+ combines IM with Noisy Student. In AIM+, the starting point is the best model from ALDT, not LDT, and the Labeled Dataset is replaced by the Augmented Labeled Dataset. In IM++ and AIM++, EvalNet is also integrated.

    How is it possible that IM++, AIM+ and AIM++ perform better then FDT?

    ISIC_GT_IM++ IM++ beats Full Dataset Training on ISIC 2018 by efficiently balances detailed and coarse annotations in its pseudo-label masks (right column) compared to the Ground Truth (GT) masks (middle column).

    Acknowledgement

    I would like to extend my heartfelt gratitude to the Deep Learning and Open Source Community, particularly to Dr. Sreenivas Bhattiprolu (https://www.youtube.com/@DigitalSreeni), Sentdex (https://youtube.com/@sentdex) and Deeplizard (https://www.youtube.com/@deeplizard), whose tutorials and shared wisdom have been a big part of my self-education in computer science and deep learning. This work would not exist without these open and free resources.

    Paper

    https://arxiv.org/abs/2401.14387

    Visit original content creator repository https://github.com/MichaelVorndran/InconsistencyMasks
  • hclua

    hclua

    This library is a high-level binding for Lua 5.4/Lua 5.3/Lua 5.2/Lua 5.1/luajit. You don’t have access to the Lua stack, all you can do is read/write variables (including callbacks) and execute Lua code.

    Build Status

    How to install it?

    Add this to the Cargo.toml file of your project

    [dependencies]
    hclua = { version = "0.1.0", features = ["lua54"] }

    How to use it?

    extern crate hclua;
    use hclua::Lua;

    The Lua struct is the main element of this library. It represents a context in which you can execute Lua code.

    let mut lua = Lua::new();     // mutable is mandatory

    Reading and writing variables

    lua.set("x", 2);
    let _: () = lua.exec_string("x = x + 1").unwrap();
    let x: i32 = lua.query("x").unwrap();
    assert_eq!(x, 3);

    Reading and writing global variables of the Lua context can be done with set and query.
    The query function returns an Option<T> and does a copy of the value.

    The base types that can be read and written are: i8, i16, i32, u8, u16, u32, f32, f64, bool, String. &str can be written but not read.

    If you wish so, you can also add other types by implementing the LuaPush and LuaRead traits.

    Executing Lua

    let x: u32 = lua.exec_string("return 6 * 2;").unwrap();    // equals 12

    The exec_string function takes a &str and returns a Option<T> where T: LuaRead.

    Writing functions

    In order to write a function, you must wrap it around hclua::functionX where X is the number of parameters. This is for the moment a limitation of Rust’s inferrence system.

    fn add(a: i32, b: i32) -> i32 {
        a + b
    }
    
    lua.set("add", hclua::function2(add));
    let _: () = lua.exec_string("c = add(2, 4)").unwrap();   // calls the `add` function above
    let c: i32 = lua.query("c").unwrap();
    assert_eq!(c, 6);

    In Lua, functions are exactly like regular variables.

    You can write regular functions as well as closures:

    lua.set("mul", hclua::function2(|a: i32, b: i32| a * b));

    Note that the lifetime of the Lua context must be equal to or shorter than the lifetime of closures. This is enforced at compile-time.

    let mut a = 5i;
    
    {
        let mut lua = Lua::new();
    
        lua.set("inc", || a += 1);    // borrows 'a'
        for i in (0 .. 15) {
            let _: () = lua.exec_string("inc()").unwrap();
        }
    } // unborrows `a`
    
    assert_eq!(a, 20)
    Error handling

    extern "C" fn error_handle(lua: *mut c_lua::lua_State) -> libc::c_int {
        let err = unsafe { c_lua::lua_tostring(lua, -1) };
        let err = unsafe { CStr::from_ptr(err) };
        let err = String::from_utf8(err.to_bytes().to_vec()).unwrap();
        println!("error:{}", err);
        0
    }
    lua.register("error_handle", error_handle);

    Default in exec_string will call pcall, and set the error_function _G[“error_handle”] so you can reset ‘error_handle’ function to you custom.

    Manipulating Lua tables

    Manipulating a Lua table can be done by reading a LuaTable object. This can be achieved easily by reading a LuaTable object.

    let _:() = lua.exec_string("a = { 9, 8, 7 }").unwrap();
    let mut table : LuaTable = lua.query("a").unwrap();
    
    let x: i32 = table.query(2).unwrap();
    assert_eq!(x, 8);
    
    table.set(3, "hello");
    let y: String = table.query(3).unwrap();
    assert_eq!(y, "hello");
    
    let z: i32 = table.query(1).unwrap();
    assert_eq!(z, 9);

    You can then iterate through the table with the .iter() function. Note that the value returned by the iterator is an Option<(Key, Value)>, the Option being empty when either the key or the value is not convertible to the requested type. The filter_map function (provided by the standard Iterator trait) is very useful when dealing with this.

    let _:() = lua.exec_string("a = { 9, 8, 7 }").unwrap();
    let mut table : LuaTable = lua.query("a").unwrap();
    for _ in 0 .. 10 {
        let table_content: Vec<Option<(u32, u32)>> = table.iter().collect();
        assert_eq!(table_content, vec![ Some((1,9)), Some((2,8)), Some((3,7)) ]);
    }

    User data

    When you expose functions to Lua, you may wish to read or write more elaborate objects. This is called a user data.

    To do so, you should implement the LuaPush for your types.
    This is usually done by redirecting the call to userdata::push_userdata.
    it will operate the ref of object
    if you use userdata::push_userdata the userdata will copy one time, for lua gc manager
    if you use userdata::push_lightuserdata the userdata life manager by rust, so none copy will occup

    use hclua_macro::ObjectMacro;
    
    #[derive(ObjectMacro, Default)]
    #[hclua_cfg(name = HcTest)]
    #[hclua_cfg(light)]
    struct HcTestMacro {
        #[hclua_field]
        field: u32,
        #[hclua_field]
        hc: String,
    }
    
    impl HcTestMacro {
        fn ok(&self) {
            println!("ok!!!!");
        }
    }
    
    
    fn main() {
        let mut lua = hclua::Lua::new();
        HcTestMacro::register(&mut lua);
        // 直接注册函数注册
        HcTestMacro::object_def(&mut lua, "ok", hclua::function1(HcTestMacro::ok));
        // 闭包注册单参数
        HcTestMacro::object_def(&mut lua, "call1", hclua::function1(|obj: &HcTestMacro| -> u32 {
            obj.field
        }));
        // 闭包注册双参数
        HcTestMacro::object_def(&mut lua, "call2", hclua::function2(|obj: &mut HcTestMacro, val: u32| -> u32 {
            obj.field + val
        }));
        HcTestMacro::object_static_def(&mut lua, "sta_run", hclua::function0(|| -> String {
            "test".to_string()
        }));
        lua.openlibs();
        
        let val = "
            print(type(HcTest));
            local v = HcTest.new();
            print(\"call ok\", v:ok())
            print(\"call1\", v:call1())
            print(\"call2\", v:call2(2))
            print(\"kkkk\", v.hc)
            v.hc = \"dddsss\";
            print(\"kkkk ok get_hc\", v:get_hc())
            v.hc = \"aa\";
            print(\"new kkkkk\", v.hc)
            v:set_hc(\"dddddd\");
            print(\"new kkkkk1\", v.hc)
            print(\"attemp\", v.hc1)
            print(\"static run\", HcTest.sta_run())
            HcTest.del(v);
        ";
        let _: Option<()> = lua.exec_string(val);
    }

    now we can custom function

    let mut lua = Lua::new();
    lua.openlibs();
    fn one_arg(obj : &mut TestLuaSturct) -> i32 { obj.index = 10; 5 };
    fn two_arg(obj : &mut TestLuaSturct, index : i32) { obj.index = index;};
    
    let mut value = hclua::LuaStruct::<TestLuaSturct>::new(lua.state());
    value.create().def("one_arg", hclua::function1(one_arg)).def("two_arg", hclua::function2(two_arg));
    
    let _ : Option<()> = lua.exec_string("x = TestLuaSturct()");
    let val : Option<i32> = lua.exec_string("return x:one_arg()");
    assert_eq!(val, Some(5));
    let obj : Option<&mut TestLuaSturct> = lua.query("x");
    assert_eq!(obj.unwrap().index, 10);
    let val : Option<i32> = lua.exec_string("x:two_arg(121)");
    assert_eq!(val, None);
    let obj : Option<&mut TestLuaSturct> = lua.query("x");
    assert_eq!(obj.unwrap().index, 121);
    
    let obj : Option<&mut TestLuaSturct> = lua.exec_string("return TestLuaSturct()");
    assert_eq!(obj.unwrap().index, 19);

    HotFix

    in runtime, if we need change some logic, we need restart the process, it may lose some memory data
    so sometimes we need update the logic, add keep the memory data, so we need hotfix

    let mut lua = Lua::new();
    lua.openlibs();
    lua.enable_hotfix();
    let _ = lua.exec_func2("hotfix", r"
        local value = {3, 4}
        function get_a()
            value[2] = 3
            return value[1]
        end
    
        function get_b()
            return value[2]
        end
        ", "hotfix");

    Refer

    the project write refer to td_rlua.

    Contributing

    Contributions are welcome!

    Visit original content creator repository
    https://github.com/hcengine/hclua

  • docker-youtrack-base

    docker-youtrack-base

    Docker YouTrack image based on Alpine Java 8.

    Built with YouTrack version 2018.1.41561 (May 11, 2018)

    This project was inspired from:

    1. uniplug/youtrack-docker
    2. esycat/docker-youtrack

    Releases

    Fresh tags:

    1. latest or 2018.1.41561

    Old tags:

    1. 2018.1.41051
    2. 2018.1.40341
    3. 2017.4.39083
    4. 2017.4.38399
    5. 2017.4.37623

    More old tags see on Docker Hub

    Releases:

    Download latest release from releases Github page.

    Install

    Run this command to create required dirs:

    mkdir -p data/youtrack/{backup,database,logs}
    

    Build image and run container. See below.

    Usage example

    1. Get latest image: docker pull pythoninja/docker-youtrack-base:latest
    2. Get tagged image : docker pull pythoninja/docker-youtrack-base:tag

    Build image

    docker build -f Dockerfile -t docker-youtrack-base:latest .
    

    Run container

    docker run --name youtrack-base \
     -v $(pwd)/data/youtrack/database/:/opt/yt/database/ \
     -v $(pwd)/data/youtrack/backup/:/opt/yt/backup/ \
     -v $(pwd)/data/youtrack/logs/:/opt/yt/logs/ \
     --rm -d -p 8080:8080 \
     pythoninja/docker-youtrack-base:latest
    

    Development

    1. Clone this repo and make changes
    2. Tag as latest: git tag latest -m "tag annotation" to run Docker Hub autobuild
    3. Tag as 0.0.0-pre.1: git tag 0.0.0-pre.1 to run Docker Hub autobuild and autotagging fresh image
    4. Push tag or tags: git push latest
    5. Create new release using Github web interface

    Checklist

    Checklist for new YouTrack release: CHECKLIST.md

    Versioning

    docker-youtrack-base follows main version of Jetbrains YouTrack. Additional number could be added due to project specified changes.

    Todo

    • Set up Docker Hub workflow
    • Create non-root user #1
    • Optimize image #3
    • Add YouTrack version checker
    • Add more variables
    • Add Github release maker

    License

    docker-youtrack-base released under the MIT license – see the LICENSE file for details.

    Visit original content creator repository
    https://github.com/pythoninja/docker-youtrack-base

  • swizzle

    Swizzle

    PyPI Latest Release Pepy Total Downloads GitHub License

    Overview

    Swizzle makes it easy to get or set multiple attributes of an object at once, using simple attribute syntax. It works with regular classes, dataclass, Enum, and more.

    It provides convenient multi-attribute access. You can grab, combine, or assign attributes in any order or combination.


    Installation

    From PyPI

    pip install swizzle

    From GitHub

    pip install git+https://github.com/janthmueller/swizzle.git

    Getting Started

    Basic Usage with the @swizzle Decorator

    import swizzle
    
    @swizzle
    class Vector:
        def __init__(self, x, y, z):
            self.x = x
            self.y = y
            self.z = z
    
    v = Vector(1, 2, 3)
    print(v.yzx)  # Output: Vector(y=2, z=3, x=1)

    Swizzled Setters

    @swizzle(setter=True)
    class Vector:
        def __init__(self, x, y, z):
            self.x = x
            self.y = y
            self.z = z
    
    v = Vector(1, 2, 3)
    v.zyx = 9, 8, 7
    print(v.zyx)  # Output: Vector(z=9, y=8, x=7)

    Tip: Using __slots__ can be a good practice when setter=True, as it helps prevent accidentally creating new attributes if names are mistyped.

    Custom Separators

    For objects with multiple fields, combining attribute names without a separator can become hard to read. You can define a separator to make expressions clearer:

    import swizzle
    
    @swizzle(sep='_')
    class Person:
        def __init__(self, name, age, city, country):
            self.name = name
            self.age = age
            self.city = city
            self.country = country
    
    p = Person("Jane", 30, "Berlin", "Germany")
    
    # Access multiple attributes clearly using underscores
    print(p.name_age_city_country)  
    # Output: Person(name='Jane', age=30, city='Berlin', country='Germany')

    Without a separator, p.nameagecitycountry is harder to read. Using sep='_' keeps your attribute combinations clear and expressive.

    Swizzled Named Tuples

    Inspired by namedtuple, swizzledtuple is the default output type for swizzled attributes.

    from swizzle import swizzledtuple
    
    Vector = swizzledtuple('Vector', 'x y z')
    v = Vector(1, 2, 3)
    
    print(v.yzx)        # Output: Vector(y=2, z=3, x=1)
    print(v.yzx.xxzyzz) # Output: Vector(x=1, x=1, z=3, y=2, z=3, z=3)

    You can also change the type of the returned object by passing the type argument to the @swizzle decorator. You could return a plain tuple or list if you prefer.

    Using Swizzle with dataclass

    from dataclasses import dataclass
    import swizzle
    
    @swizzle
    @dataclass
    class Point:
        x: int
        y: int
        z: int
    
    p = Point(1, 2, 3)
    print(p.zxy)  # Output: Point(z=3, x=1, y=2)

    Swizzling Enums with meta=True

    from enum import IntEnum
    import swizzle
    
    @swizzle(meta=True)
    class Axis(IntEnum):
        X = 1
        Y = 2
        Z = 3
    
    print(Axis.YXZ)  # Output: Axis(Y=<Axis.Y: 2>, X=<Axis.X: 1>, Z=<Axis.Z: 3>)

    Setting meta=True enables swizzling on class attributes.


    Documentation and Advanced Usage

    For more advanced features, custom settings, and examples, see the full documentation: Swizzle Docs


    Feedback and Use Cases

    Swizzle was built to explore flexible attribute manipulation in Python. Feedback and suggestions are welcome. I would love to hear:

    • Interesting use cases you discover
    • Ideas for improvements or additional features

    Feel free to open an issue or PR if you try it out.


    License

    MIT License. See LICENSE

    Visit original content creator repository https://github.com/janthmueller/swizzle
  • calculatrice-salaire-net

    GH language GH tag GH release GH license GH stars

    Node CI

    visiteurs

    Calculatrice Salaire Net TangoMan

    La Calculatrice Salaire Net TangoMan permet de convertir votre salaire brut en net horaire, journalier, mensuel, annuel sur une base de 35 heures ou 39 heures par semaine en fonction des charges auxquelles vous êtes soumis et de votre nombre de congés par an.

    Pour tester l’application c’est ici !.

    🎯 Fonctionalités

    La Calculatrice Salaire Net TangoMan est disponible en mode PWA (Progressive Web App), vous pouvez donc l’installer et l’utiliser hors connection avec une expérience utilisateur proche de celle d’une application native (mobile ou ordinateur de bureau).

    🚀 Installation

    Les PWA permettent une expérience utilisateur semblable aux applications natives sur mobile ou application de bureau. Elles sont installables sur toute plateforme comforme aux standards web et fonctionnent hors connexion.

    ⚡ Installer une PWA sur Android

    Une pop up apparaît automatiquement lors du premier chagement de la page. Sinon selectionnez “Ajouter à l’écran d’acceuil”

    Sur Android les PWA permettent la reception de notifications push et la synchronisation en arrière-plan entre autres fonctionalités natives.

    ⚡ Installer une PWA sur iOS

    Pour installer une PWA sur iOS, il faut ouvrir le menu de partage de Safari et sélectionner l’option “Sur l’écran d’accueil”.

    Depuis la version 12.2 iOS améliore la prise en charge des PWA, mais Apple est toujours rétissant à les prendre en charge complètement dans la mesure ou elles permettent de contourner l’App Store.

    ⚡ Installer une PWA sur desktop

    Pour installer une PWA sur ordinateur de bureau, ouvrez les paramètres de votre navigateur (en haut à droite sur chrome) une option est disponible pour installer l’application.

    ⚡ manifest.json

    Pour plus d’informations sur le standard du fichier manifest.json : json.schemastore.org

    💻 Dépendances

    La Calculatrice Salaire Net TangoMan utilise :

    🔥 Développement

    ⏳ TL;DR

    Pour installer l’environnement de développement et ouvrir la Calculatrice Salaire Net TangoMan dans votre navigateur en une seule commande:

    $ make up

    🤖 Environnement de développemnt

    Vous aurez besoin de yarn et de “vue-cli”

    Vous pouvez entrer les commandes suivante pour installer automatiquement l’environnment de developpement.

    $ make yarn-install
    $ make vue-cli-install

    🤖 Pour installer la Calculatrice Salaire Net

    Entrez la commande suivante

    $ make install

    🤖 Pour démarrer la Calculatrice Salaire Net dans un serveur local

    Entrez la commande suivante

    $ make serve

    🤖 Pour déployer la Calculatrice Salaire Net sur github pages

    Entrez la commande suivante

    $ make deploy

    🔖 git

    🐧 Installer git (Linux)

    $ sudo apt-get install --assume-yes git

    🏁 Installer git (Windows)

    Téléchargez et installez la dernière version à partir de git-scm.com

    🍎 Installer git (OSX)

    $ brew install git

    🔧 Configuration de git

    Pousser la branche actuelle uniquement si l’amont existe

    $ git config --global push.default simple

    Définir vim comme éditeur par défaut de git

    $ git config --global core.editor 'vim'

    ⚡ Initialiser les sous-modules

    Afin de télécharger des sous-modules de projet, entrez la commande suivante

    $ git submodule update --init --recursive

    🛠 Make

    🐧 Installer Make (Linux)

    Sur une machine sous Linux, entrez la commande suivante

    $ sudo apt-get install --assume-yes make

    🏁 Installer Make (Windows)

    Sur Windows, vous devrez d’abord installer cygwin ou GnuWin make pour exécuter le script.

    🍎 Install Make (OSX)

    Make devrait être disponible par défaut sur OSX, mais vous pouvez le mettre à jour avec la commande suivante

    $ brew install make

    🦖 Node.js

    🐧 Installer Node.js (Linux)

    Sur une machine sous Linux, installez Node globalement avec les commandes suivantes (nécessite curl):

    $ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
    $ sudo apt-get install --assume-yes nodejs

    🏁 Installer Node.js (Windows)

    Téléchargez et installez la version LTS à partir de Node.js

    🍎 Installer Node.js (OSX)

    Téléchargez et installez la version LTS à partir de Node.js


    🦄 Sass

    🐧 Installer Sass (Linux)

    Sur une machine sous Linux, installez sass globalement avec les commandes suivantes

    With yarn:

    $ sudo yarn global add sass

    With npm:

    $ sudo npm install sass -g

    🧶 Yarn

    🐧 Installer Yarn (Linux)

    Sur une machine sous Linux, installez yarn globalement avec les commandes suivantes (nécessite curl):

    $ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
    $ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
    $ sudo apt-get update
    $ sudo apt-get install --assume-yes yarn

    🏁 Installer Yarn (Windows)

    Téléchargez et installez la dernière version à partir de: yarnpkg.com

    🍎 Installer Yarn (OSX)

    Vous pouvez installer Yarn via le gestionnaire de paquets “Homebrew”. Cela installera également Node.js s’il n’est pas déjà installé.

    $ brew install yarn

    🕶 Vue-Cli

    🧶 Installer avec Yarn

    Installez vue-cli globalement avec la commande suivante

    $ sudo yarn global add @vue/cli

    📦 Installer avec npm

    Installez vue-cli globalement avec la commande suivante

    $ sudo npm install -g @vue/cli-service-global

    📝 Notes

    D’autres calculatices sur le web:

    La calculatrice du gouvernement pour l’impôt sur le revenu:

    🤝 Contribuer

    Merci pour votre intérêt à apporter votre contribution à Calculatrice Salaire Net TangoMan.

    Veuillez consulter le code de conduite et les directives de contribution avant de commencer à travailler sur des fonctionnalités.

    Si vous souhaitez ouvrir un rapport de bug, veuillez d’abord vérifier qu’il n’a pas déjà été signalé avant d’en créer un nouveau.

    📜 License

    Copyrights (c) 2024 “Matthias Morin” <mat@tangoman.io>

    License Distribué sous la licence MIT.

    Si vous aimez Calculatrice Salaire Net TangoMan, mettez une étoile, suivez-moi ou publiez un tweet.

    GitHub stars GitHub followers Twitter

    … Et jetez un oeil à mes autres projets.

    🙏 Remerciements

    Ce script a été généré avec makefile-generator

    Visit original content creator repository https://github.com/TangoMan75/calculatrice-salaire-net