Skip to content

Instantly share code, notes, and snippets.

@diefans
diefans / sync-history.sh
Created September 24, 2021 10:10 — forked from jan-warchol/sync-history.sh
Synchronize history across bash sessions
# Synchronize history between bash sessions
#
# Make history from other terminals available to the current one. However,
# don't mix all histories together - make sure that *all* commands from the
# current session are on top of its history, so that pressing up arrow will
# give you most recent command from this session, not from any session.
#
# Since history is saved on each prompt, this additionally protects it from
# terminal crashes.
@diefans
diefans / my-nixos-installation.md
Created September 13, 2021 18:48
NixOS installation guide, tailored to my needs

Preface

This manual describes how to install, use and extend NixOS, a Linux distribution based on the purely functional package management system Nix, that is composed using modules and packages defined in the Nixpkgs project.

Installation

This section describes how to obtain, install, and configure NixOS for first-time use.

Obtaining NixOS

NixOS ISO images can be downloaded from the NixOS download page. There are a number of installation options. In this manual we will assume that the chosen option is Minimal ISO image (64bit). You can burn it on a USB stick with:

@diefans
diefans / nixos.md
Created September 13, 2021 18:18 — forked from martijnvermaat/nixos.md
Installation of NixOS with encrypted root
@diefans
diefans / mongo_registry.go
Created June 3, 2021 10:38 — forked from SupaHam/mongo_registry.go
mongo-go-driver UUID decoder & encoder for Golang
// This is a value (de|en)coder for the github.com/google/uuid UUID type. For best experience, register
// mongoRegistry to mongo client instance via options, e.g.
// clientOptions := options.Client().SetRegistry(mongoRegistry)
//
// Only BSON binary subtype 0x04 is supported.
//
// Use as you please
package repository
import (
@diefans
diefans / http-benchmark.md
Created March 28, 2021 18:42 — forked from denji/http-benchmark.md
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
@diefans
diefans / background-xdg-open.sh
Created December 25, 2020 09:03 — forked from guiniol/background-xdg-open.sh
offlineimap + notmuch + mutt + gpg + mstmp
#!/bin/bash
xdg-open "$1" &
sleep 1
@diefans
diefans / corporate-linux-desktop-howto.md
Created May 10, 2019 12:09 — forked from jtyr/corporate-linux-desktop-howto.md
How to run Linux desktop in a corporate environment

How to run Linux desktop in a corporate environment

DISCLAIMER

Some of the practices described in this HOWTO are considered to be illegal as they often break internal corporate policies. Anything you do, you do at your own risk.

@diefans
diefans / aioudp.py
Created October 15, 2018 14:49 — forked from vxgmichel/aioudp.py
High-level UDP endpoints for asyncio
"""Provide high-level UDP endpoints for asyncio.
Example:
async def main():
# Create a local UDP enpoint
local = await open_local_endpoint('localhost', 8888)
# Create a remote UDP enpoint, pointing to the first one
@diefans
diefans / Makefile
Created October 4, 2018 23:30 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@diefans
diefans / yieldable_asyncio_udp_client.py
Created October 4, 2018 11:24 — forked from kwarunek/yieldable_asyncio_udp_client.py
Yieldable/awaitable asyncio UDP client (sendto only actually)
import asyncio
import socket
class UDPClient():
def __init__(self, host, port, loop=None):
self._loop = asyncio.get_event_loop() if loop is None else loop
self._sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self._sock.setblocking(False)
self._addr = (host, port)