Skip to content

Instantly share code, notes, and snippets.

Дамјан Георгиевски gdamjan

Block or report user

Report or block gdamjan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View demo.erl
-module(demo).
-export([main/0]).
%%% export these cause they are spawned:
-export([server_loop/2, client_loop/3]).
main() ->
{ok, Pid} = server(2),
client(Pid, critical, 15),
client(Pid, normal, 10),
@gdamjan
gdamjan / async-set-wds.py
Last active May 16, 2019
configure a wifi interface to 4add/wds mode via iwd
View async-set-wds.py
#!/usr/bin/python3
from gi.repository import GLib
import dbus
import dbus.mainloop.glib
import sys
if len(sys.argv) != 2:
print('Usage: {} <mac-address>'.format(sys.argv[0]))
@gdamjan
gdamjan / buildah.yml
Last active Apr 5, 2019
ansible + podman & buildah
View buildah.yml
---
# works with ansible 2.7
# ansible-playbook buildah.yml
#
# `debian:stretch` and `image-name` should probably be extra vars
#
- name: bootstrap a container
hosts: localhost
become: no
gather_facts: no
@gdamjan
gdamjan / jail.sh
Last active Feb 8, 2019
try to jail yay (and similar aur helpers)
View jail.sh
#! /bin/sh
## custom nsjail for yay
BASE_JAIL=(
--symlink /usr/bin:/bin
--symlink /usr/lib:/lib64
--bindmount_ro /dev/null
--bindmount_ro /usr
--bindmount_ro /etc/passwd
@gdamjan
gdamjan / build.sh
Last active Feb 7, 2019
update deb package for matrix-synapse to 0.99.0
View build.sh
# deps
sudo apt install python3-systemd python3-attr python3-bcrypt python3-blist \
python3-canonicaljson python3-daemonize python3-frozendict python3-jsonschema \
python3-msgpack python3-nacl python3-netaddr python3-phonenumbers python3-pil \
python3-prometheus-client python3-psutil python3-pyasn1 python3-pymacaroons \
python3-pysaml2 python3-service-identity python3-signedjson python3-sortedcontainers \
python3-treq python3-twisted python3-unpaddedbase64 python3-yaml
cd /tmp
@gdamjan
gdamjan / make-portable.sh
Last active Feb 1, 2019
make the most minimal portable service with alpine - https://systemd.io/PORTABLE_SERVICES.html
View make-portable.sh
#! /bin/sh
ROOTFS=`mktemp -d rootfs.XXX -t`
TMPDIR=/tmp
TARBALL=alpine-minirootfs-3.9.0-x86_64.tar.gz
URL=http://dl-cdn.alpinelinux.org/alpine/v3.9/releases/x86_64/$TARBALL
[ "$URL" ] && wget -c $URL
mkdir $ROOTFS
@gdamjan
gdamjan / coproc-example.sh
Created Jan 28, 2019
co-processes in bash
View coproc-example.sh
#! /bin/bash
# runs asynchronously in a subshell, named sudo_proc
coproc sudo_proc {
sudo /bin/bash -c "ls /root -ld; read _sync; ls /root -ld"
}
echo sleeping …
sleep 10
echo sleeped …
@gdamjan
gdamjan / button.py
Created Jan 27, 2019
PyQt5 QButton, emoji and QDesktopServices.openUrl
View button.py
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton
from PyQt5.QtGui import QDesktopServices
from PyQt5.QtCore import pyqtSlot, QUrl
class MainWindow(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("Button demo")
button = QPushButton('Click me \U0001F951', self)
@gdamjan
gdamjan / 10-README.md
Last active Apr 7, 2019
sway experiment (it's an experiment since it's not a daily driver - many things just suck)
View 10-README.md

sway systemd integration

  • sway will exec systemctl --user start sway-session.target in its config file
  • sway-session.target has BindsTo=graphical-session.target
  • and for example swayidle.service will have either WantedBy=sway-session.target or graphical-session.target
    • same with swaybar/waybar, mako, and similar.

Timeline of events:

  • user logins
  • pam starts systemd --user
@gdamjan
gdamjan / latest-stretch-ami.sh
Last active May 15, 2019
Get the AMI id of the latest official (owner-id 379101102735) Debian stretch image (hvm-x86_64-gp2) | awscli + jq
View latest-stretch-ami.sh
# Debian
aws ec2 describe-images \
--region us-east-1 \
--owners 379101102735 \
--filters 'Name=name,Values=debian-stretch-hvm-x86_64-gp2-*' |
jq '.Images | sort_by(.CreationDate) | .[-1] | .ImageId, .Name'
##
# additional filters:
# 'Name=name,Values=debian-stretch-*'
You can’t perform that action at this time.