Skip to content

Instantly share code, notes, and snippets.

View nforro's full-sized avatar

Nikola Forró nforro

  • Red Hat
  • Brno, Czech Republic
View GitHub Profile
@nforro
nforro / logs.diff
Created March 23, 2023 14:02
Difference between logs on worker and captured logs of a job run
--- worker.log 2023-03-23 14:56:46.365050154 +0100
+++ job.log 2023-03-23 14:58:55.505729917 +0100
@@ -25,8 +25,6 @@ target_branch:
2023-03-23 11:57:05.612 DEBUG Cloning repo https://github.com/storaged-project/libbytesize.git -> /tmp/sandcastle using repository cache at /repository-cache
2023-03-23 11:57:05.612 DEBUG Repositories in the cache (1 project(s)):
- lost+found
-2023-03-23 11:57:05.612 DEBUG Popen(['git', 'clone', '-v', '--tags', '--', 'https://github.com/storaged-project/libbytesize.git', '/tmp/sandcastle'], cwd=/src, universal_newlines=True, shell=None, istream=None)
-2023-03-23 11:57:06.558 DEBUG Cmd(['git', 'clone', '-v', '--tags', '--', 'https://github.com/storaged-project/libbytesize.git', '/tmp/sandcastle'])'s unused stdout:
2023-03-23 11:57:06.637 DEBUG We just cloned git repo https://github.com/storaged-project/libbytesize.git to /tmp/sandcastle.
2023-03-23 11:57:06.637 DEBUG Parsed ref 'master' from the repo <git.repo.base.Repo '/tmp/sandcastle/.git'>.
import inspect
import types
def setattr_(instance, name, value):
try:
if next(iter(inspect.signature(value).parameters), None) == 'self':
# bind method to instance
value = types.MethodType(value, instance)
except TypeError:
@nforro
nforro / focus.py
Last active January 21, 2020 11:28
#!/usr/bin/python
import Xlib
import Xlib.display
def main():
display = Xlib.display.Display()
screen = display.screen()
screen.root.change_attributes(event_mask=Xlib.X.SubstructureNotifyMask)
diff --git a/test.c b/test.c
index 05799bd..0f0153c 100644
--- a/test.c
+++ b/test.c
@@ -10,6 +10,11 @@ int variableA = -1;
*/
int variableB = 0;
+/*
+ * this is variable C
@nforro
nforro / Makefile
Last active November 28, 2018 15:28
.PHONY: install
dirA:
mkdir -p $(DESTDIR)/$@
touch $(DESTDIR)/$@/fileA
touch $(DESTDIR)/$@/fileB
dirB:
mkdir -p $(DESTDIR)/$@
touch $(DESTDIR)/$@/fileX

Helpers

.. toctree::
   :glob:

   helpers/*
match = re.match(r'^rgb:([A-Fa-f0-9]{1,4})/([A-Fa-f0-9]{1,4})/([A-Fa-f0-9]{1,4})$', spec)
if match:
rgb = match.groups()[1:]
bitwidth = max([len(s) for s in rgb]) * 4
return [int(s, 16) for s in rgb], bitwidth
SUCCESS = logging.INFO + N
...
_nameToLevel = {
'SUCCESS': SUCCESS,
...
}
def __getattr__(self, level):
severity = CUSTOM_LOGGING_LEVELS.get(level)
def log_to_level(message, *args, **kwargs):
if self.isEnabledFor(severity):
self._log(severity, message, *args, **kwargs)
if severity:
return log_to_level
class Test(object):
def __getattr__(self, name):
def test(arg1, arg2):
print('args: {0} {1}'.format(arg1, arg2))
if name in ['testA', 'testB']:
return test
raise AttributeError