Skip to content

Instantly share code, notes, and snippets.

View julian-klode's full-sized avatar

Julian Andres Klode julian-klode

View GitHub Profile
#!/usr/bin/python
import glob, os.path,collections, apt_pkg
interpreters=["bash", "sh", "python", "perl"]
_scale = {'kB': 1024.0, 'mB': 1024.0*1024.0,
'KB': 1024.0, 'MB': 1024.0*1024.0}
def mem_usage(pid):
This file has been truncated, but you can view the full file.
03-01 02:26:31.977 3746-3788/org.jak_linux.dns66 W/System.err: [AdVpnThread] INFO org.pcap4j.packet.factory.PacketFactories - Succeeded in FactoryBinder.getInstance()
03-01 02:26:32.034 3746-3788/org.jak_linux.dns66 W/System.err: [AdVpnThread] WARN org.pcap4j.util.PropertiesLoader - [org/pcap4j/packet/factory/packet-factory.properties] Could not get value by org.pcap4j.packet.Packet.classFor.unknownNumber, use default value: class org.pcap4j.packet.UnknownPacket
03-01 02:26:32.035 3746-3788/org.jak_linux.dns66 W/System.err: [AdVpnThread] INFO org.pcap4j.util.PropertiesLoader - [org/pcap4j/packet/factory/packet-factory.properties] Got org.pcap4j.packet.IpV6Packet by org.pcap4j.packet.Packet.classFor.org.pcap4j.packet.namednumber.EtherType.0x86dd
03-01 02:26:32.041 3746-3788/org.jak_linux.dns66 W/System.err: [AdVpnThread] INFO org.pcap4j.util.PropertiesLoader - [org/pcap4j/packet/factory/packet-factory.properties] Got org.pcap4j.packet.factory.PropertiesBasedIpV6TrafficClassFactory by org.pcap4j.packet.IpV6Pack
@julian-klode
julian-klode / .htaccess
Last active March 22, 2017 16:07
changelog components redirector .htaccess file
# Boilerplate
Options +Indexes
RewriteEngine on
## Sample redirect rules for every section.
#
# This file assumes that the changelogs are exposed at /changelogs/pool/COMPONENT/..., like
# on the Debian and Ubuntu servers, and that changelogs is a subdirectory of the document root.
#
# The first condition prevents infinite redirects (alternative: RewriteCond $1 !^main$)
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#define MIN(A, B) (((A) < (B)) ? (A) : (B))
struct buffered_fd {
int fd;
size_t bufstart;
size_t bufused;
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "jkdiff.h"
struct tar_header {
char name[100];
char mode[8];
char uid[8];
char gid[8];
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system

JSON Hooks

APT 1.6 introduces support for hooks that talk JSON-RPC 2.0. Hooks act as a server, and APT as a client.

Wire protocol

APT communicates with hooks via a UNIX domain socket in file descriptor $APT_HOOK_SOCKET. The transport is a byte stream (SOCK_STREAM).

#!/usr/bin/python3
import json
import os
import socket
import sys
socketFd=int(os.environ["APT_HOOK_SOCKET"])
@julian-klode
julian-klode / README.md
Last active June 8, 2019 18:58
Setting up a server-side encrypted maildir

This describes the idea behind an encrypted maildir on the server, with multiple clients that have access to it, and store unencrypted copies.

Initial setup:

  1. Generate a gpg key like maildir@jak-linux.org
  2. Import the public key into the keyring on the server
  3. Import private and public keys into keyring on the clients

On the server:

  1. Create an empty Maildir
#!/usr/bin/env python3
"""Encrypt/Decrypt GPG/MIME messages"""
import os
import sys
import email.mime.application
import email.mime.multipart
import email.mime.message
import errno