This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import socket | |
| import struct | |
| def _ipv4_to_u32(ip_str: str) -> int: | |
| # network-order (big-endian) to host int | |
| return struct.unpack("!I", socket.inet_aton(ip_str))[0] | |
| def bond_layer3_4_hash_tcp( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <title>This domain is gone. Redirecting...</title> | |
| <style> | |
| body { | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| font-size: 2em; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Execute with: | |
| # | |
| # virtualenv venv | |
| # source venv/bin/activate | |
| # pip3 install influxdb | |
| # python3 goinflux.py | |
| # | |
| from influxdb import InfluxDBClient |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # PARSING AN ISO8601 WITH OFFSET FORMATTED STRING USING A PYTHON VERSION PRIOR | |
| # TO 3.7 WITH THE STANDARD LIBRARY ONLY | |
| # | |
| # | |
| # For the formatting: | |
| # | |
| # This returns a datetime object with the timezone set to UTC. | |
| # The internal time can now be interpreted as UTC. | |
| # | |
| # datetime.now(timezone.utc) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def split(iterable, criteria=lambda e: e): | |
| """ | |
| Split a collection in two parts as defined by the given criteria. | |
| Usage:: | |
| >>> split([1,2,3,4,5,6], lambda e: e > 2) | |
| ([3, 4, 5, 6], [1, 2]) | |
| By default, the element itself is used as the criteria:: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from time import monotonic | |
| from functools import wraps | |
| def cache(expiration_s): | |
| """ | |
| Cache the result of a function for certain time. | |
| There is one restriction: all arguments of the wrapped function must be | |
| immutable, that is, they must be used as key in a dictionary. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import groovy.json.JsonOutput | |
| result = [] | |
| Jenkins.instance.queue.items.each { | |
| // Only consider BuildableItem | |
| // Other known objects are: | |
| // - BlockedItem, which lacks the runId | |
| if (it instanceof Queue.BuildableItem) { | |
| result.add([ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!-- Generated with glade 3.22.1 --> | |
| <interface> | |
| <requires lib="gtk+" version="3.20"/> | |
| <requires lib="vte-2.91" version="0.52"/> | |
| <object class="GtkWindow" id="window"> | |
| <property name="can_focus">False</property> | |
| <signal name="delete-event" handler="stop" swapped="no"/> | |
| <child> | |
| <placeholder/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from resource import RLIMIT_NOFILE, getrlimit, setrlimit | |
| def setfilelimits(limit): | |
| soft, hard = getrlimit(RLIMIT_NOFILE) | |
| if limit > hard: | |
| raise RuntimeError( | |
| 'Unable to raise open files limit to {}. ' | |
| 'Hard limit is set to {}'.format( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt install meld | |
| git config --global alias.difftree 'difftool --dir-diff' | |
| git config --global diff.tool meld | |
| git config --global difftool.prompt false | |
| # Now use it: | |
| # git difftree master..HEAD | |
| # git difftree e49286eb1acbae69058856c744676c63d1154ba6..57adcd018d6e11c0982187cddfce6ee2bb641c6d |
NewerOlder