Skip to content

Instantly share code, notes, and snippets.

View Nicarim's full-sized avatar

Marcin Gordziejewski Nicarim

  • Poland, Warszawa
View GitHub Profile
@Nicarim
Nicarim / boot.log
Created April 10, 2022 16:49
RE650 v2 boot log
===================================================================
MT7621 stage1 code Dec 16 2019 17:45:55 (ASIC)
CPU=500000000 HZ BUS=166666666 HZ
==================================================================
@Nicarim
Nicarim / vector-poc.yml
Created April 8, 2022 21:00
minimal poc for #12042 bug in vectordotdev/vector
apiVersion: v1
kind: Namespace
metadata:
name: vector
---
apiVersion: v1
data:
vector.yaml: |
healthchecks:
enabled: true
@Nicarim
Nicarim / Caddyfile
Created February 19, 2022 21:42
caddy LDAP paperless using remote-user auth proxy (DEVELOPMENT version)
{
http_port 8080
https_port 8443
debug
order authenticate before respond
security {
authentication portal myportal {
crypto default token lifetime 3600
@Nicarim
Nicarim / question.md
Created November 6, 2019 15:20
Theoretical quesiton that struck my mind related to ORM

A theoretical question about testing application state, which got stuck in my mind for a while:

Let's assume you're doing some kind of feature inside the code base, which requires you to create a new query to a Django Model. For example let's use Question model which we have. Requirement for my feature is that I want to retrieve Question with its some_field equal to 1337 or 1338 and I want it to present to a user.

class Question:
  id = PKField()
 one_of_bools = BoolField()
@Nicarim
Nicarim / generate_schema.py
Created June 28, 2019 11:59
Generator of swagger schematics based on common sense.
from inspect import isclass
from os.path import dirname, join
import django
import oyaml as yaml
from django.conf import settings
from django.core.exceptions import ViewDoesNotExist
from django.core.management import BaseCommand
from django.urls import URLPattern, URLResolver
from rest_framework import serializers
@Nicarim
Nicarim / folder_difference.py
Created February 14, 2019 21:09
Finds a recursive difference between folder "TARGET_DIR" and "SOURCE_DIR" assuming that "SOURCE_DIR" is larger folder, and copies all files not found in "TARGET_DIR" to "DIFF_DIR_COPY"
import glob
import hashlib
import os
import pickle
import shutil
from os.path import basename, join
def get_sha1_from_path(path):
BUF_SIZE = 200000 # lets read stuff in 64kb chunks!