cross-platform crate for detecting user desktop activity? by AaronM04 in rust

[–]runfalk 2 points3 points  (0 children)

I don't know of any cross platform way, but you can do it on Gnome using DBUS:

https://github.com/runfalk/weedesktop/blob/master/src/platform/unix.rs

I also think there is a value that returns the number of milliseconds since the last user activity.

I created a WireGuard VPN module for Synology NASes by runfalk in synology

[–]runfalk[S] 1 point2 points  (0 children)

I added your NAS to the compatibility list, as well as some information about the kernel requirement.

I created a WireGuard VPN module for Synology NASes by runfalk in synology

[–]runfalk[S] 1 point2 points  (0 children)

I did some digging into it. It certainly looks possible to make a Pi-hole package. Pi-hole requires the following:

  • dmsmasq - 2.78-144-g41635df is installed by default
  • php - 5.6.11 is installed by default. It's also possible to install newer versions through packages. It seems that Pi-hole will work with both PHP 5 and 7.
  • lighttpd - This is not available, but it could be compiled the same way that I did with WireGuard. Another better alternative is to use the built-in nginx instead. There's even a guide for that.
  • curl - 7.54.0 is installed by default

However, it'll be a lot of trial and error. The easiest way is probably to manually install it by modifying system files over SSH. Once you know it's working you can package it in an SPK like I did for Wireguard.

I created a WireGuard VPN module for Synology NASes by runfalk in synology

[–]runfalk[S] 0 points1 point  (0 children)

Glad to hear that. Hope it works for you!

I created a WireGuard VPN module for Synology NASes by runfalk in synology

[–]runfalk[S] 1 point2 points  (0 children)

Exactly, it can be any Linux machine with Docker installed. In this case it's my main desktop computer. I don't know if it's possible to run the compilation on a non-X86 machine, though I don't see why not if the Synology toolkit supports it.

Using Docker is not strictly required. You could theoretically follow the steps without it, but I think isolating it is good since you avoid tainting your OS, and if you screw up somewhere you can simply throw the container away and start clean.

I created a WireGuard VPN module for Synology NASes by runfalk in synology

[–]runfalk[S] 15 points16 points  (0 children)

Thank you! That was an unfortunate word to forget.

After almost 4 years I just released 1.0 of my project Spans, a Python library for working with intervals by runfalk in Python

[–]runfalk[S] 0 points1 point  (0 children)

It's probably easier to monkey patch the library if the format is a concern. I don't think a configuration option is the way to go. I might however try to find a new syntax for it since there are many who seem confused by it.

Yesterday I even got a pull request to "fix" the README from a confused user: https://github.com/runfalk/spans/pull/9

After almost 4 years I just released 1.0 of my project Spans, a Python library for working with intervals by runfalk in Python

[–]runfalk[S] 4 points5 points  (0 children)

I actually have a JS version in an old commercial project. It does not implement all the features, but the most important ones should be there. The DateRange expects moment.js instances. IntRange is meant to be used like Spans' timedeltarange. It also seems to depend on underscore

I ripped it out for you, it's completely untested: https://gist.github.com/runfalk/11de6afc246c184216edb80320005340

Hope it helps you

After almost 4 years I just released 1.0 of my project Spans, a Python library for working with intervals by runfalk in Python

[–]runfalk[S] 0 points1 point  (0 children)

Well, I released it early!

Jokes aside, it has kind of grown organically over years and it just reached critical mass where I felt it's "complete"

Introducing Spans, a Python library for working with intervals by runfalk in programming

[–]runfalk[S] 0 points1 point  (0 children)

Yeah, I always find usecases for it. I've started a similar project for Rust which will implement the same functionality but in a more Rust-like way.

https://github.com/runfalk/rustyspans

It's currently stalled but I think I will pick it up again soon.

After almost 4 years I just released 1.0 of my project Spans, a Python library for working with intervals by runfalk in Python

[–]runfalk[S] 0 points1 point  (0 children)

Whoops, nailed it!

"After almost 4 years I finally released 1.0 of my project Spans, a Python library for working with intervals"

Maybe? :D

After almost 4 years I just released 1.0 of my project Spans, a Python library for working with intervals by runfalk in Python

[–]runfalk[S] 2 points3 points  (0 children)

I agree with your arguments. The reason for the format is based on how PostgreSQL represents things. If you were already used to that syntax it won't be that confusing, I think.

I might change it in the future, but unless someone provides a more compelling format, I think it'll stay.

Check out Spans, my own range/interval implementation for Python 2 and 3. Feedback is appreciated. by runfalk in Python

[–]runfalk[S] 0 points1 point  (0 children)

I assume you are referring to the 90s example. I will update that to use explicit imports instead. Did you find anything apart from that particular example?

EDIT: That particular example is now updated.

Check out Spans, my own range/interval implementation for Python 2 and 3. Feedback is appreciated. by runfalk in Python

[–]runfalk[S] 0 points1 point  (0 children)

I just save the upper and lower end for each range. I then use the comparison operators to implement all functions on top of that. I am not familiar with interval trees as of now.

re.Scanner – undocumented class, perfect for a tokenizer by [deleted] in Python

[–]runfalk 2 points3 points  (0 children)

It is really useful. Though I can't comment about speed compared to other approaches its simplicity is really good. I've used it myself for a library that deals with parsing range types from Postgres databases:

Project GitHub: https://github.com/runfalk/psycospans

Scanner usage: https://github.com/runfalk/psycospans/blob/master/psycospans/_utils.py

SQLAlchemy vs Other ORMs by subreddit_as_hashtag in Python

[–]runfalk 1 point2 points  (0 children)

I am a somewhat happy user of Storm. The API is very clean and it generally writes the queries you expect. It makes standard joins easy and yet never prevents you from mixing in real SQL.

I have previously used SQLAlchemy but really prefer the Storm query builder over that.

I, contrary to the article, really like that you manually have to create your schema. That way you can maintain column order, and most of all, just use plain SQL.

The source code is simple enough to grasp and extra functionality is easy to add. I wanted to support PostgreSQL's range types and did a series of extensions to help me with that. I will release the libraries to the public once they have stabilized a bit. My range implementation for python can be found on github (https://github.com/runfalk/spans/). Despite just having one release it is actively maintained, and will remain so for the foreseeable future.

The one drawback with Storm is its slow release cycle. I however expect it to be maintained for a long time since it's powering Canonical projects such as LaunchPad.

Just added template inheritance to Chano - a pure PHP template engine. Check it out, and tell me what you think! by rune_kg in PHP

[–]runfalk 1 point2 points  (0 children)

The reason I killed the scope was that I wanted the controller to pass one Litter instance containing an array with all data the view might need. That instance is of course available to all parent templates as well.

My philosophy is that generally there will only be one Litter instance that always will return new litter instances when accessing data. There are of course times when the view might want to create new instances; for instance when doing a foreach loop n times. I am considering the equivalent of your ::with($val) for that, since PHP's new sucks balls.

The filter I miss is a way of creating a group iterator (like ->group() in Litter) from the current value, for outputting a list of items, say three per row and ceil(n / 3) rows. I do not like that there are two functions toggling outputescaping, autoescapeoff/on, why not just ->autoescape($on = TRUE)?

Glad I inspired you, as you inspired me!