Skip to content

Instantly share code, notes, and snippets.

enkore

  • Europe
Block or report user

Report or block enkore

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@enkore
enkore / test.py
Created Aug 19, 2018 — forked from hhslepicka/test.py
Coverage QThread Test
View test.py
import time
from PyQt5.QtCore import QThread
class Worker(QThread):
def __init__(self):
QThread.__init__(self)
self.counter = 0
View gist:727e3f912c8f9380017fb78591f2a05e
from PySide2 import QtWidgets, QtCore
class MyTableView(QtWidgets.QTableView):
SECTION_SIZE = 70
def __init__(self, parent=None):
super(MyTableView, self).__init__(parent)
def setModel(self, mdl):
super().setModel(mdl)
@enkore
enkore / borg_key_encrypt.rst
Last active May 20, 2017
What happens when you call key.encrypt(something) in Borg?
View borg_key_encrypt.rst

AESKeyBase

def encrypt(self, chunk):

data = self.compressor.compress(chunk)
CNONE: Allocate new string of size len(chunk) + 2, copy two type bytes, copy len(chunk) into it, point data at result.
View perf_inproc.py
#!/usr/bin/env python
# coding: utf-8
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
#
# Some original test code Copyright (c) 2007-2010 iMatix Corporation,
# Used under LGPLv3
import argparse
@enkore
enkore / _cache.c
Created Mar 9, 2017
f/fastcachesync
View _cache.c
#include <msgpack.h>
// 2**32 - 1025
#define _MAX_VALUE ( (uint32_t) 4294966271 )
#define MIN(x, y) ((x) < (y) ? (x): (y))
typedef struct {
HashIndex *chunks;
//msgpack_sbuffer sbuf;
@enkore
enkore / qubes3.2-hidpi.rst
Created Nov 21, 2016
How to Hi-DPI with Qubes R3.2 and KDE
View qubes3.2-hidpi.rst

I use KDE in dom0, it looks much better than XFCE and is imho much easier to use (type-ahead search in the start menu for starters). Also, contrary to XFCE, which is based on Gtk2, even the relatively old version shipped in dom0 has decent Hi-DPI support, as opposed to none at all in XFCE. The best gtk2 can do is scale in 100 % (!) steps.

Hi-DPI is still a bit cumbersome, especially if you switch between lo DPI and hi DPI (eg. builtin screen and external screen).

View gist:ec4de5326b34716de1dee208e058d85d
static int
flags_from_portable(int pflags)
{
int flags = 0;
if ((pflags & SSH2_FXF_READ) &&
(pflags & SSH2_FXF_WRITE)) {
flags = O_RDWR;
} else if (pflags & SSH2_FXF_READ) {
flags = O_RDONLY;
@enkore
enkore / gist:2895fff15cee672c936448cb276e3c9c
Created Nov 12, 2016
OpenSSL 1.1+ ChaCha20-Poly1305 API test (RFC 7539 2.8.2)
View gist:2895fff15cee672c936448cb276e3c9c
#include <string.h>
#include <stdint.h>
#include <openssl/evp.h>
uint8_t data[] = {
0x4c, 0x61, 0x64, 0x69, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x47, 0x65, 0x6e, 0x74, 0x6c,
0x65, 0x6d, 0x65, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6c, 0x61, 0x73,
0x73, 0x20, 0x6f, 0x66, 0x20, 0x27, 0x39, 0x39, 0x3a, 0x20, 0x49, 0x66, 0x20, 0x49, 0x20, 0x63,
0x6f, 0x75, 0x6c, 0x64, 0x20, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x6f,
0x6e, 0x6c, 0x79, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x74, 0x69, 0x70, 0x20, 0x66, 0x6f, 0x72, 0x20,
View show-odd-cache.py
"""
show-odd-cache.py
-----------------
Usage:
python show-odd-cache.py <repository> [<column to sort on>] [<number of entries to show>]
Prints a list of the twenty cache entries with the highest reference count.
This makes certain kinds of cache corruption (by bad drives, RAM etc) easy.
@enkore
enkore / borg-show-free-space.py
Last active Jul 28, 2016
Show freeable space in a borg repository.
View borg-show-free-space.py
"""
{[0]} path/to/hints.N
Show freeable space in a borg repository.
That is, amount of bytes accounted to deleted objects that have not been
compacted away yet.
"""
You can’t perform that action at this time.