I hereby claim:
- I am rif on github.
- I am rif (https://keybase.io/rif) on keybase.
- I have a public key ASDGzWKFfj0sz-HG-rbtNhIJuaRgkkheicvFX5_AB4SSDAo
To claim this, I am signing this object:
| #!/usr/bin/env python3 | |
| from subprocess import check_output | |
| from json import loads | |
| from re import findall, DOTALL, MULTILINE | |
| def find_focused(tree): | |
| if tree["focused"] == True: | |
| return tree["pid"] | |
| elif 'nodes' in tree: |
| #!/usr/bin/env python3 | |
| from subprocess import check_output | |
| from re import findall, DOTALL, MULTILINE | |
| inputs = findall(r'.*?index: (\d+).*?sink: (\d+).*?application\.process\.id = "(\d+)"', | |
| check_output(['pacmd', 'list-sink-inputs']).decode("utf-8"), DOTALL|MULTILINE) | |
| sinks = findall(r'index: (\d+)', check_output(['pacmd', 'list-sinks']).decode("utf-8")) | |
| focused_window = check_output(['xdotool', 'getwindowfocus']) | |
| focused_pid = check_output(['xdotool', 'getwindowpid', focused_window]).strip().decode("utf-8") |
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "log" | |
| "sort" | |
| "time" | |
| "github.com/gocolly/colly" |
| 04f3096f7f07fff50233225ecf5f7ccc76f5d2835f89dedb379a44942265fb2eae93523ddcef28ca5f71abafe2d75078c411e2af7631e4ceb9f9ac2a19e084db16 andrewallaway |
I hereby claim:
To claim this, I am signing this object:
| import json, socket, itertools | |
| class JSONClient(object): | |
| socket = None | |
| def __init__(self, addr): | |
| self.socket = socket.create_connection(addr) | |
| self.id_counter = itertools.count() | |
| def __del__(self): | |
| if self.socket is not None: | |
| self.socket.close() |
| diff --git a/sources/29-web2py-english/13.markmin b/sources/29-web2py-english/13.markmin | |
| index 599d8b8..8e8c01e 100644 | |
| --- a/sources/29-web2py-english/13.markmin | |
| +++ b/sources/29-web2py-english/13.markmin | |
| @@ -1138,8 +1138,8 @@ An alternative to Memcache is use Redis. ``Redis``:inxx | |
| Assuming we have Redis installed and running on localhost at port 6379, we can connect to it using the following code (in a model): | |
| -`` | |
| -from gluon.contrib.redis import RedisCache |
| package main | |
| import ( | |
| "bytes" | |
| "encoding/gob" | |
| "encoding/json" | |
| "testing" | |
| "time" | |
| ) |