Thanks to visit codestin.com
Credit goes to gist.github.com

Skip to content

Instantly share code, notes, and snippets.

View kherney's full-sized avatar
:octocat:
Focusing

Kevin Herney kherney

:octocat:
Focusing
View GitHub Profile
@kherney
kherney / Environment.md
Created January 28, 2025 02:00
Manage Environments

In Odoo 17, creating a new instance of the Environment class with a separate database transaction (cr) involves manually managing the database cursor and environment. This is useful for isolated operations (e.g., background tasks, logging, or multi-database interactions). Below is a step-by-step guide:


Key Concepts

  1. Environment: Combines a database cursor (cr), user ID (uid), and context.
  2. Registry: Holds the database models and connection pool.
  3. Manual Transaction Control: You must explicitly commit()/rollback() and close() the cursor.

sudo apt install bridge-utils
sudo cp /etc/network/interfaces /etc/network/interfaces-backup-DATE
sudo gedit /etc/network/interfaces
auto lo
iface lo inet loopback
auto enp0s31f6
iface enp0s31f6 inet manual
@kherney
kherney / Installation.md
Created October 9, 2019 14:17 — forked from albertbori/Installation.md
Automatically disable Wifi when an Ethernet connection (cable) is plugged in on a Mac

Overview

This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.

Most the credit for these changes go to Dave Holland.

Requirements

  • Mac OSX 10+
  • Administrator privileges
def setPolicy(self,object):
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(object.sizePolicy().hasHeightForWidth())
object.setSizePolicy(sizePolicy)
return False
def addline(self, rowSpan):
@kherney
kherney / README-Template.md
Created August 19, 2018 16:33 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@kherney
kherney / UIparser.py
Created July 25, 2018 22:29
Compatibilidad entre PyQwt4 y Qt4Designer en librerias Qwt. Los "Headers" Qwt de C++ (qwt_plot.h, qwt_text_label.h) deben ser encontrados en PyQt4.Qwt5.
# /usr/lib/python2.7/dist-packages/PyQt4/uic
# IN:
def customWidgets(self, elem):
def header2module(header):
"""header2module(header) -> string
Convert paths to C++ header files to according Python modules
>>> header2module("foo/bar/baz.h")
'foo.bar.baz'
"""