diff options
author | jeschli <jeschli@gmail.com> | 2018-07-09 14:31:33 +0200 |
---|---|---|
committer | jeschli <jeschli@gmail.com> | 2018-07-09 14:31:33 +0200 |
commit | 22d09fb80703944abed87d97527fd75ef959c492 (patch) | |
tree | 7559cbff17decdcd2720bb0cc87466478e474e33 | |
parent | d1c6baf00e98a0229fc7fd96874623efc8417b05 (diff) | |
parent | b3476561c5fddc324cdfebb1cae84834d21fae52 (diff) |
Merge remote-tracking branch 'origin/master'
-rw-r--r-- | krebs/5pkgs/simple/Reaktor/plugins.nix | 23 | ||||
-rw-r--r-- | krebs/krops.nix | 2 | ||||
-rw-r--r-- | lass/1systems/helios/config.nix | 3 |
3 files changed, 18 insertions, 10 deletions
diff --git a/krebs/5pkgs/simple/Reaktor/plugins.nix b/krebs/5pkgs/simple/Reaktor/plugins.nix index 7573c9256..c303f9fb3 100644 --- a/krebs/5pkgs/simple/Reaktor/plugins.nix +++ b/krebs/5pkgs/simple/Reaktor/plugins.nix @@ -121,21 +121,26 @@ rec { pattern = "^.*(?P<args>http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+).*$$"; path = with pkgs; [ curl perl ]; script = pkgs.writePython3 "url-title" [ "beautifulsoup4" "lxml" ] '' + import cgi import sys import urllib.request from bs4 import BeautifulSoup try: - soup = BeautifulSoup(urllib.request.urlopen(sys.argv[1]), "lxml") - title = soup.find('title').string + req = urllib.request.Request(sys.argv[1]) + req.add_header('user-agent', 'Reaktor-url-title') + resp = urllib.request.urlopen(req) + if resp.headers['content-type'].find('text/html') >= 0: + soup = BeautifulSoup(resp.read(16000), "lxml") + title = soup.find('title').string - if title: - if len(title) > 512: - print('message to long, skipped') - elif len(title.split('\n')) > 5: - print('to many lines, skipped') - else: - print(title) + if len(title.split('\n')) > 5: + title = '\n'.join(title.split('\n')[:5]) + + print(title[:450]) + else: + cd_header = resp.headers['content-disposition'] + print(cgi.parse_header(cd_header)[1]['filename']) except: # noqa: E722 pass ''; diff --git a/krebs/krops.nix b/krebs/krops.nix index 6a8a05726..861f2d323 100644 --- a/krebs/krops.nix +++ b/krebs/krops.nix @@ -12,7 +12,7 @@ krebs-source = { nixpkgs.git = { - ref = "91b286c8935b8c5df4a99302715200d3bd561977"; + ref = "56fad146a12a6f934d1d5ef875eb729be1b19129"; url = https://github.com/NixOS/nixpkgs; }; stockholm.file = toString ../.; diff --git a/lass/1systems/helios/config.nix b/lass/1systems/helios/config.nix index bd7f75c3e..5657742a6 100644 --- a/lass/1systems/helios/config.nix +++ b/lass/1systems/helios/config.nix @@ -71,6 +71,9 @@ with import <stockholm/lib>; hashPassword thunderbird dpass + + # we want tensorflow! (with GPU acceleration) + python3Packages.tensorflowWithCuda ]; users.users = { |