Skip to content

Instantly share code, notes, and snippets.

View kaos's full-sized avatar

Andreas Stenius kaos

View GitHub Profile
@kaos
kaos / README.md
Last active October 18, 2021 15:28
Plugin with custom target to work on python source files

Example output (edited for readability):

$ ./pants package src/example:dags-demo
17:16:25.12 [INFO] Initializing scheduler...
17:16:25.41 [INFO] Scheduler initialized.
17:16:27.41 [INFO] (

HydratedSources(
  snapshot=Snapshot(
    digest=(89d98482b939d9f4b99c1ad4bfcf8ba49344fd536459773f4e70ac019f5914b6, 77), 
@kaos
kaos / list_python_package_top_level_modules.sh
Created March 8, 2021 18:41
Print a list of all packages with "non standard" top level modules
#!/usr/bin/env bash
#
# Outputs package info (in yaml format) for all installed packages
# with non-standard or additional top level modules.
#
# Usage: ./build-support/python/find_module_mappings.sh [.../site-packages]
#
# Will look up default site packages for current python unless
# provided.
@kaos
kaos / list-pkg-versions.py
Created April 28, 2018 11:38
pip list available package versions
#!/usr/bin/env python
# When you want a easy way to get at all (or the latest) version of a certain python package from a PyPi index.
import sys
import logging
try:
from pip._internal import cmdoptions, main
from pip._internal.commands import commands_dict
from pip._internal.basecommand import RequirementCommand
@kaos
kaos / Vagrantfile
Created May 30, 2013 18:58
Vagrant setup for zotonic
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise32"
@kaos
kaos / mq.capnp
Last active May 3, 2017 13:35
MQTT transport for capnp RPC
@0xe425876d9fb9589c
# Disclaimer, I'm no pubsub expert, so there may be inconsitencies and
# other errors in concept or layout with regard to how the queues and
# topics work.
interface Broker {
publish (message :Message, topic :Topic) -> (result :Result);
subscribe (subscriber :Subscriber, topic :Topic) -> (result: Result);
}
@kaos
kaos / keybase.md
Last active July 28, 2016 19:00
Proof of identity for keybase.

Keybase proof

I hereby claim:

  • I am kaos on github.
  • I am kaos (https://keybase.io/kaos) on keybase.
  • I have a public key ASDjrQ4z8zESmWU718ZrzB-1NY_QmPKt4_T7qwuZ3dwFrAo

To claim this, I am signing this object:

@kaos
kaos / bench
Created September 13, 2013 22:26
erlydtl scanner benchmark
#!/usr/bin/env escript
%% -*- mode: erlang -*-
%% Usage: ./bench <run time in seconds> <template file to scan>
%% Defaults to 2 seconds on 'bench.dtl'.
main([]) ->
run_benchmark(2, "bench.dtl");
main([Time]) ->
run_benchmark(list_to_integer(Time), "bench.dtl");
@kaos
kaos / _admin_edit_content.device.tpl
Created December 28, 2012 11:03
Adding custom properties to the zotonic admin backend.
{% extends "admin_edit_widget_std.tpl" %}
{% block widget_title %}{_ Device Details _}{% endblock %}
{% block widget_show_minimized %}false{% endblock %}
{% block widget_content %}
<fieldset class="admin-form">
{# Attention flag #}
<div class="form-item clearfix">
@kaos
kaos / transcript
Last active December 10, 2015 00:28
2012/12/21 Alain O'Dea <alain.odea@gmail.com>: > Brace yourselves for a brain dump :) > Here is a fairly literal transcript of how I did this for my blog. Some scripts will need path changes, etc. to work on your setup.
Create an SSH key:
ssh-keygen
Create a repository named blog.alainodea.com in Github:
Go to Settings
Click on Deploy Keys
Click on Add Deploy Key
Set Title to "zotonic-sync"
Set Key to the content of /home/zotonic/.ssh/id_rsa.pub
@kaos
kaos / app_docker-compose.yml
Created October 2, 2015 11:46
rancher/2190
svcA:
image: busybox
command:
- sleep
- 3600
external_links:
- global/HAproxy:svcB.example.com