Skip to content

Instantly share code, notes, and snippets.

@akokshar
akokshar / ansible-summary.md
Created January 1, 2019 12:57 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

# Ring the bell if any background window rang a bell
set -g bell-action any
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -g default-terminal screen-256color
# Keep your finger on ctrl, or don't
bind-key ^D detach-client
# Create splits and vertical splits
package main
import (
"flag"
"net/http"
"log"
"net/url"
"encoding/json"
"os"
"io/ioutil"
@akokshar
akokshar / gist:3ec755327a9a860f5e0ccc55e80c7066
Created April 1, 2018 16:22
json serializer, deserealizer lexer
import kotlin.coroutines.experimental.buildIterator
import kotlin.reflect.KProperty1
import kotlin.reflect.full.findAnnotation
import kotlin.reflect.full.memberProperties
@Target(AnnotationTarget.PROPERTY)
annotation class JsonFileld
interface JsonSerializable
import kotlin.reflect.full.findAnnotation
import kotlin.reflect.full.memberProperties
@Target(AnnotationTarget.PROPERTY)
annotation class JsonFileld
interface JsonSerializable
private fun JsonSerializable.serialize() = javaClass.kotlin.memberProperties.asSequence()
.filter {
import kotlin.reflect.full.memberProperties
data class File(val type: Int = 0, val name: String)
private fun Any.serialize() = javaClass.kotlin.memberProperties.asSequence()
.filter {
when (it.get(this)) {
is String, is Int -> true
else -> false
}
@akokshar
akokshar / fdfmdaemon.py
Created July 7, 2017 07:29 — forked from PotatoesMaster/fdfmdaemon.py
A simple daemon implementing freedesktop.org's file manager interface.This interface is used by Firefox download manager to select a downloaded file in the file manager (since Firefox 28).
#!/usr/bin/env python
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law. You can redistribute it and/or modify it under
# the terms of the Do What The Fuck You Want To Public License, Version 2, as
# published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
"""
This is a simple daemon implementing freedesktop.org's file manager interface
(http://www.freedesktop.org/wiki/Specifications/file-manager-interface/).
@akokshar
akokshar / client.py
Created July 7, 2017 07:24 — forked from caspian311/client.py
Simple client-service dbus example in python.
#!/usr/bin/env python
import dbus
class Client():
def __init__(self):
bus = dbus.SessionBus()
service = bus.get_object('com.example.service', "/com/example/service")
self._message = service.get_dbus_method('get_message', 'com.example.service.Message')
self._quit = service.get_dbus_method('quit', 'com.example.service.Quit')
@akokshar
akokshar / xresource_test.c
Created January 16, 2017 20:17 — forked from dcat/xresource_test.c
Xresource example
/* $CC -o xresources_test xresources_test.c -lX11 */
#include <X11/Xresource.h>
#include <string.h>
#include <stdio.h>
#define XRESOURCE_LOAD_STRING(NAME, DST) \
XrmGetResource(db, NAME, "String", &type, &ret); \
if (ret.addr != NULL && !strncmp("String", type, 64)) \
DST = ret.addr;