Skip to content

Instantly share code, notes, and snippets.

@fpytloun
fpytloun / deploy-docker.yml
Last active July 25, 2019 15:14
Docker kubernetes pod deployment
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations: {}
labels:
app: docker
name: docker
spec:
template:
metadata:
@fpytloun
fpytloun / kube_certdump.sh
Created January 18, 2019 11:33
Dump kubernetes certificates
#!/bin/bash -e
log_info() {
echo "INFO: $*"
}
log_info "Getting all certificates"
kubectl get certificate --all-namespaces --no-headers | while read cert; do
namespace=$(echo $cert | awk '{print $1}')
name=$(echo $cert | awk '{print $2}')
@fpytloun
fpytloun / libvirt_kvm.rst
Created January 4, 2019 12:40
Libvirt and KVM

Using Libvirt and KVM

Installation

Install required packages
apt-get install qemu-kvm libvirt-bin bridge-utils virtinst
import time
import json
import esp
import machine
def read_dht11(pin):
import dht
d = dht.DHT11(machine.Pin(pin))
@fpytloun
fpytloun / webex.dockerfile
Last active August 22, 2016 17:09
Join Webex meeting in Docker without messing your system
FROM ioft/i386-ubuntu:16.04
#FROM ubuntu:xenial
## Arguments
ARG user=filip
ARG user_uid=1000
ARG locale=cs_CZ.UTF-8
ARG jre_url=http://download.oracle.com/otn-pub/java/jdk/8u102-b14/jre-8u102-linux-i586.tar.gz
ENV RUN_USER $user
@fpytloun
fpytloun / docker_app.sh
Created August 22, 2016 16:23
Wrapper to run desktop app of Docker container
#!/bin/bash
[ ${DEBUG:-0} -eq 1 ] && set -x
XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/run/user/${UID}}
XDG_DOWNLOAD_DIR=$(xdg-user-dir DOWNLOAD)
IMAGE=${IMAGE:-"apps/$1"}
EXTRA_OPTS=${OPTS:-""}
DOCKER_OPTS_COMMON=(
@fpytloun
fpytloun / C10shell
Created August 4, 2016 15:02
pbuilder hook to access shell on FTBFS
#!/bin/bash
# example file to be used with --hookdir
#
# invoke shell if build fails.
echo "=== BUILD FAILED"
read -r -p "=== Do you want to enter shell and investigate situation? (Y/n) " res < /dev/tty > /dev/tty 2> /dev/tty
if [[ ${res,,} =~ ^(yes|y|)$ ]]; then
BUILDDIR="${BUILDDIR:-/tmp/buildd}"
apt-get install -y "${APTGETOPT[@]}" vim-nox less
@fpytloun
fpytloun / lenovo_kbd.sh
Created July 28, 2016 08:25
Setup Lenovo USB keyboard
#!/bin/bash
#
# Setup Lenovo USB keyboard with trackpoint
# Systemd users:
# /etc/udev/rules.d/99-lenovo-kbd.rules:
# ACTION=="add", ATTR{idVendor}=="17ef", ATTR{idProduct}=="6047", TAG+="systemd", ENV{SYSTEMD_WANTS}="udev-lenovo-kbd-attach.service"
# /etc/systemd/system/udev-lenovo-kbd-attach.service:
# [Service]
# Type=oneshot
# ExecStart=/usr/local/bin/lenovo_kbd.sh
@fpytloun
fpytloun / gdebuild.sh
Last active October 19, 2017 11:14
Cowbuilder/git-buildpackage wrapper
#!/bin/bash -e
#
# Put something like this into /etc/sudoers:
# Defaults env_reset,env_keep+="DEB* DIST ARCH ADT OS"
# Cmnd_Alias PBUILDER = /usr/sbin/pbuilder, /usr/bin/pdebuild, /usr/bin/debuild-pbuilder, /usr/sbin/cowbuilder, /usr/sbin/chroot, /usr/bin/git-buildpackage
# @adm ALL=(root) NOPASSWD: PBUILDER
#
[ -z "$DEBUG" ] || set -x
# this is your configuration file for pbuilder.
# the file in /usr/share/pbuilder/pbuilderrc is the default template.
# /etc/pbuilderrc is the one meant for overwriting defaults in
# the default template
#
# read pbuilderrc.5 document for notes on specific options.
APTCACHE="/car/cache/pbuilder/aptcache"
USENETWORK="no"
HOOKDIR="/etc/pbuilder/hooks"