HNHacker News
TopNewBestAskShowJobs

fdomingues

16 karma · joined March 23, 2017

submissionscomments
fdomingues··on 10g Upgrade
What are the use cases for multi gbps home network or internet access? With a 1/1 Gbps link we could use 500 Mbps to transfer 5 TBytes per day of home assistant backups, time machine deltas, security footage..., and still have the other 500 Mbps to do whatever we want.
fdomingues··on Django: One ORM to rule all databases
I have made this tiny module to use it wherever I want it.

https://github.com/domingues/djangify-package

fdomingues··on A valid HTML zip bomb
That content shift on page scroll is horrendous. Please don't do that, there is no need to auto hide a side bar.
fdomingues··on Alt.Anonymous.Messages Newsgroup
Some time ago I created a chat that uses the same principles, it's funny to have some ideas validated by something that has been around for over 20 years and that I didn't know existed.

https://github.com/domingues/vortex/

fdomingues··on Zero regrets: Firefox power user kept 7,500 tabs open for two years
To overcome the hoarding I use Simple Tab Groups[1], that has auto backup, combined with Auto Tab Discard[2], to completely inactivate open, but unused, tabs.

[1] https://addons.mozilla.org/en-US/firefox/addon/simple-tab-gr...

[2] https://addons.mozilla.org/en-US/firefox/addon/auto-tab-disc...

fdomingues··on A website hosted on a floppy disk (Be patient while it's loading)
Happy to see it converted from the old flash applet.
fdomingues··on Problems once solved by a metaclass can be solved by __init_subclass__
Is useful to do code generation/transformation, for example in this utility[1] it uses the information provided on the declaration of the class to generate the methods required by the base class.

The user of the utility write this:

    class Book(objects.Object):
        title: Optional[str]
And the generated class code is:

    class Book(Base):
        __slots__ = ('title', )
        title: typing.Optional[str]
    
        def __init__(self, title=None):
            self.title = title
    
        @classmethod
        def from_data(cls, data):
            title = data.get('title', None)
            return cls(title=title)
    
        def to_data(self):
            data = {}
            if self.title is not None:
                data['title'] = self.title
            return data
    
        @classmethod
        def from_oracle_object(cls, obj):
            return cls(title=obj.title)
    
        def to_oracle_object(self, connection):
            obj = connection.gettype('Book').newobject()
            obj.title = self.title
            return obj
[1]https://github.com/domingues/oracle-object-mapping
fdomingues··on C++ Is 9.4 Times Faster Than Python in Prime Number Test
C++ Is NOT 9.4 Times Faster Than Python in Prime Number Test

I added 3 lines to the Python code and got it 10x faster:

    (venv) $ python prime.py 
    Number of primes between 0 to 1000000 = 78498
    Elapsed time: 6.502481937408447
    (venv) $ python prime.py 
    Number of primes between 0 to 1000000 = 78498
    Elapsed time: 0.6258630752563477
Diff:

    3c3,5
    < 
    ---
    > import numba
    >  
    > @numba.njit
    14a17
    > @numba.njit
fdomingues··on Python 3.9 is around the corner
Since Python 3.7 you can postpone evaluation of the annotations[1].

You can do something like this:

  from __future__ import annotations

  Class Node:
      parent: Optional[Node]
[1] https://www.python.org/dev/peps/pep-0563/
fdomingues··on $PHP = ;
$=${$}[$]; $($);

Actually some time ago I found some piece of alien PHP code (a backdoor) in my server, and I couldn't understand it! I did't know the $($); syntax. After searching for that and not finding anything I discovery that exist one special Unicode character that is invisible.

Full code here: https://imgur.com/a/Cggdx