Skip to content

Instantly share code, notes, and snippets.

View julian-klode's full-sized avatar

Julian Andres Klode julian-klode

View GitHub Profile
## Automatic power management on Intel platforms
##
## Copyright (C) 2015 Julian Andres Klode
##
##
# Runtime power management
ACTION=="add", SUBSYSTEM=="pci", ATTR{power/control}="auto"
ACTION=="add", SUBSYSTEM=="i2c", ATTR{power/control}="auto"
ACTION=="add", SUBSYSTEM=="spi", ATTR{power/control}="auto"
#include <cairo.h>
#include <cairo-pdf.h>
#include <poppler.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
cairo_surface_t *surface;
cairo_t *cairo;
@julian-klode
julian-klode / gist:05466ec53047589bef7dc10e765b8b45
Created May 9, 2016 21:53
Fancy systemctl list-timers output
NEXT LEFT LAST PASSED UNIT ACTIVATES
Mon 2016-05-09 23:14:01 CEST 38min ago Mon 2016-05-09 23:52:49 CEST 28ms ago borg-backup-light.timer borg-backup-light.service
n/a n/a Sun 2016-05-08 22:46:32 CEST 1 day 1h ago obnam-backup.timer obnam-backup.service
2 timers listed.
Pass --all to see loaded but inactive timers, too.
@julian-klode
julian-klode / CMakeLists.txt
Last active August 8, 2016 13:59
APT Documentation CMakeLists.txt draft
include(Documentation)
set(LINGUAS de es fr it ja nl pl pt_BR pt)
set(ENTITIES
apt.ent
apt-verbatim.ent
../vendor/${CURRENT_VENDOR}/apt-vendor.ent
)
if (WITH_DOC)
@julian-klode
julian-klode / tagkeys
Last active September 24, 2016 17:55
Generator for an order-preserving minimal perfect hash function
Package
Version
Architecture
Multi-Arch
Section
Source
Size
Installed-Size
Priority
Depends
AndroidManifest: Request WRITE_EXTERNAL_STORAGE permission

The app crashes on Lollipop when trying to download files, but
it seems to work fine on Marshmallow. Officially, setDestinationUri()
is documented to require that permission but the other methods like
setDestinationInExternalFilesDir() are not - and since Marshmallow
they are intended to work without the permission, compare

See android@ed30deae5fe5b9de142b44933001c9b098c47712

package main
import "github.com/julian-klode/goapt"
func main() {
session := goapt.NewSession()
apt := session.Cache().Lookup("apt", "native")
cand := session.Policy().CandidateVersion(apt)
@julian-klode
julian-klode / t.go
Last active January 26, 2017 20:00
// Package main prints the memory usage of the system grouped
// by Debian package.
package main
import (
"bufio"
"bytes"
"flag"
"fmt"
"io/ioutil"
package main
type Link struct {
Href string `json:"href"`
}
type Links struct {
First Link `json:"first"`
Last Link `json:"last"`
Next Link `json:"next"`
Self Link `json:"self"`
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...Starting pkgProblemResolver with broken count: 19
Starting 2 pkgProblemResolver with broken count: 19
Investigating (0) python3:amd64 < 3.5.1-4 @ii mK Ib >
Broken python3:amd64 Depends on libpython3-stdlib:amd64 < 3.5.1-4 -> 3.5.3-1 @ii umU > (= 3.5.1-4)