Skip to content

Instantly share code, notes, and snippets.

Avatar
🇨🇿
Wypili moją krew na hejnał

Glutexo Glutexo

🇨🇿
Wypili moją krew na hejnał
  • Frýdek, Czechia
View GitHub Profile
@Glutexo
Glutexo / combinations.exs
Created Jun 13, 2022
Recursive combinations with subsets
View combinations.exs
defmodule Combination do
def combine([]) do
[]
end
def combine([head | tail]) do
tail_combinations = combine(tail)
merged_combinations = Enum.map(
[[]] ++ tail_combinations,
fn c -> c ++ [head] end
@Glutexo
Glutexo / Pokemon.csv
Last active Mar 21, 2022
Hra na myšlenou potvoru
View Pokemon.csv
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Stáhněte si z https://raw.githubusercontent.com/frenzymadness/Data_analysis_workshop/master/data/Pokemon.csv.
@Glutexo
Glutexo / get_core_version_from_insights_client_rpm.py
Last active Feb 4, 2022
Get Insights Core version from Insights Client RPM
View get_core_version_from_insights_client_rpm.py
from contextlib import contextmanager
from os.path import join
from rpmfile import open as rpm_open
from sys import argv
from zipfile import ZipFile
EGG_PATH = join(".", "etc", "insights-client", "rpm.egg")
VERSION_PATH = join("insights", "VERSION")
@Glutexo
Glutexo / magic_cell.py
Last active Nov 30, 2021
A cell object that doesn’t require knowledge of any names
View magic_cell.py
_NOTHING = object()
DELETE = object()
class Cell:
def __init__(self, value=_NOTHING):
if value is not _NOTHING:
self.value = value
def __call__(self, value=_NOTHING):
@Glutexo
Glutexo / cell.py
Created Nov 30, 2021
A mutable cell with the simplest API possible
View cell.py
_SENTINEL = object()
class Cell:
def __init__(self, value=_SENTINEL):
if value is not _SENTINEL:
self.value = value
def __call__(self, value=_SENTINEL):
if value is not _SENTINEL:
@Glutexo
Glutexo / data_collector.patch
Last active Nov 9, 2021
Data Collector patch for Insights Core to limit collection only to a single file
View data_collector.patch
Index: insights/client/data_collector.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/insights/client/data_collector.py b/insights/client/data_collector.py
--- a/insights/client/data_collector.py (revision 42907d96132d4877ac588e6aa090b0cd4adbfcf1)
+++ b/insights/client/data_collector.py (date 1636398517420)
@@ -320,6 +320,13 @@
rm_commands = rm_conf.get('commands', [])
@Glutexo
Glutexo / get_file_from_insights_archive.py
Last active Mar 21, 2022
Get a file from an Insights archive
View get_file_from_insights_archive.py
from collections import namedtuple
from contextlib import contextmanager
from functools import partial
from io import BytesIO
from io import StringIO
from os.path import join
from re import escape
from re import fullmatch
from shlex import quote
from tarfile import open as tar_open
@Glutexo
Glutexo / uninstall-all-pip-packages.xonsh
Created Sep 12, 2021
xonsh script to uninstall all pip packages
View uninstall-all-pip-packages.xonsh
for line in $(pip freeze).split("\n"):
. try:
. package, _ = line.split("==")
. except ValueError:
. continue
. else:
. $(pip uninstall -y @(package))
View gist:5669c06ef54e60684c4433e0a9e29534
Obsah:
* 2020.08.27 APA - FINAL AZ signature only - Legal Redactions
* 1. Definitions.
* 1.1. “Accounting Standards” means International Financial Reporting Standards (IFRS).
* 1.2. “Additional Doses” has the meaning given in Section 5.3.
@Glutexo
Glutexo / pomodoro.html
Created Sep 24, 2020
A simple experiment with JavaScript objects
View pomodoro.html
<!DOCTYPE HTML>
<html>
<head>
<title>Pomodoro</title>
<meta charset="utf-8"/>
</head>
<body>
<script>