Skip to content

Instantly share code, notes, and snippets.

View omushpapa's full-sized avatar

omushpapa

View GitHub Profile
@omushpapa
omushpapa / 00_README.md
Created August 27, 2023 11:41 — forked from reagent/00_README.md
Custom HTTP Routing in Go

Custom HTTP Routing in Go

Basic Routing

Responding to requests via simple route matching is built in to Go's net/http standard library package. Just register the path prefixes and callbacks you want invoked and then call the ListenAndServe to have the default request handler invoked on each request. For example:

package main

import (
import logging
from celery.app.defaults import DEFAULT_TASK_LOG_FMT, DEFAULT_PROCESS_LOG_FMT
class CeleryTaskFilter(logging.Filter):
def filter(self, record):
return record.processName.find('Worker') != -1
@omushpapa
omushpapa / pyproject.toml
Created August 23, 2020 08:07
Odoo Dependencies
[tool.poetry]
name = "odoo-dev"
version = "0.1.0"
description = ""
authors = []
[tool.poetry.dependencies]
python = ">=3.6,<3.8"
OdooRPC = "^0.7.0"
babel = "=2.3.4"
@omushpapa
omushpapa / README.md
Last active July 17, 2020 21:34
Ethernet to Wifi Bridge (Raspberry Pi - Ubuntu 18.04)
  1. Install wifi-api snap install wifi-ap.
  2. After installation, I had issues with DHCP connections, so I connected every device by assigning static IPs
  3. Ensure the Pi has a static IP address over eth0. wifi-ap assigns it a static IP address at wlan0
  4. Bridge using IP tables, see example:
# eth0 has internet connection
# wlan0 lacks internet connection
# 192.168.0.x subnet for eth0

sudo iptables -A FORWARD -o eth0 -i wlan0 -s 192.168.0.0/24 -m conntrack --ctstate NEW -j ACCEPT
@omushpapa
omushpapa / noip2.service
Created June 20, 2020 20:49 — forked from NathanGiesbrecht/noip2.service
Systemd Service file for no-ip.com dynamic ip updater
# Simple No-ip.com Dynamic DNS Updater
#
# By Nathan Giesbrecht (http://nathangiesbrecht.com)
#
# 1) Install binary as described in no-ip.com's source file (assuming results in /usr/local/bin)
# 2) Run sudo /usr/local/bin/noip2 -C to generate configuration file
# 3) Copy this file noip2.service to /etc/systemd/system/
# 4) Execute `sudo systemctl daemon-reload`
# 5) Execute `sudo systemctl enable noip2`
# 6) Execute `sudo systemctl start noip2`
@omushpapa
omushpapa / workflow.md
Created June 19, 2020 20:30
Versioning and Git Workflow

Semantic Versioning

Details:

Versions are denoted using a standard triplet of integers: MAJOR.MINOR.PATCH. The basic intent is that MAJOR versions are incompatible, large-scale upgrades of the API. MINOR versions retain source and binary compatibility with older minor versions, and changes in the PATCH level are perfectly compatible, forwards and backwards.

@omushpapa
omushpapa / docker_dedicated_filesystem.md
Created June 14, 2019 15:34 — forked from hopeseekr/docker_dedicated_filesystem.md
Putting Docker on its own pseudo filesystem

Docker on BTRFS is very buggy and can result in a fully-unusable system, in that it will completely butcher the underlying BTRFS filesystem in such a way that it uses far more disk space than it needs and can get into a state where it cannot even delete any image, requiring one to take drastic actions up to and including reformatting the entire affected BTRFS root file system.

According to the official Docker documentation:

btrfs requires a dedicated block storage device such as a physical disk. This block device must be formatted for Btrfs and mounted into /var/lib/docker/.

In my experience, you will still run into issues even if you use a dedicated partition. No, it seems it requires a standalone

@omushpapa
omushpapa / consumer.py
Created May 3, 2019 17:09
Sample Consumer-Publisher
from collections import OrderedDict
from concurrent.futures import ThreadPoolExecutor
import pika
import datetime
import logging
import json
from logging import StreamHandler
from time import sleep
from random import randint
@omushpapa
omushpapa / new-window.sh
Created November 21, 2018 09:47
Opens an incognito Chrome window that has a temporary and isolated profile. Useful for debugging sessions with different user accounts.
#! /usr/bin/env bash
nohup google-chrome --temp-profile --user-data-dir=/tmp/google-chrome.$RANDOM --incognito --no-first-run --disable-extensions --disable-default-apps --disable-infobars &>/dev/null &
# https://docs.docker.com/engine/admin/systemd/
Many Linux distributions use systemd to start the Docker daemon. This document shows a few examples of how to customize Docker’s settings.
Starting the Docker daemon
Once Docker is installed, you will need to start the Docker daemon.
$ sudo systemctl start docker
# or on older distributions, you may need to use
$ sudo service docker start
If you want Docker to start at boot, you should also: