Skip to content

Instantly share code, notes, and snippets.

View ryanc-me's full-sized avatar

Ryan Cole ryanc-me

View GitHub Profile
@ryanc-me
ryanc-me / qemu
Last active November 10, 2024 20:49
KVM Port-Forward Script
#!/bin/bash
#
# INSTRUCTIONS
#
# 1. Place this script at /etc/libvirt/hooks/qemu
# 2. Make it executable: $ sudo chmod +x /etc/libvirt/hooks/qemu
# 3. Add your forwarding rules at the bottom of this file
# 4. Restart the VM, or restart the libvirtd service
#
# Author: Ryan Cole
@QuietNoise
QuietNoise / G910 Keyboard Fix.ahk
Last active October 21, 2024 14:22
G910 Keyboard Fix for double typing problem
;What does this script do?
;It's a workaround for broken G910 Logitech keyboards (possibly other keyboards too) whereby some keys occasionally register multiple keystrokes for one kkkkkeypress.
;The key bug appears because keyboard registers multiple keystrokes in a very short timespan even though you pressed the key only once.
;This script makes it so the subsequent keystrokes registered in a very short timespan are ignored thus outputing the key only for the first stroke.
;List all your broken keys between quotes below. I.e. if your broken keys are g and f then the line below shoud be
;brokenKeys := "gf"
brokenKeys := "gf"
@ryanc-me
ryanc-me / update_quant_reservation.md
Last active November 13, 2024 13:21
Improve logging (previously "Lot: 0000001" would show, even if no lot was set)

Update Quant Reservation

"It is not possible to unreserve more products of <product name> than you have in stock"


Sometimes, the reserved_quantity on the stock.quant record for a product becomes out-of-sync with the sum of the reserved quantity in stock.move.lines for that product.

For example, consider:

  • Product A (quant): on-hand = 50, reserved = 10
quants = env['stock.quant'].search([])
move_line_ids = []
warning = ''
for quant in quants:
move_lines = env["stock.move.line"].search([
('product_id', '=', quant.product_id.id),
('location_id', '=', quant.location_id.id),
('lot_id', '=', quant.lot_id.id),
('package_id', '=', quant.package_id.id),
@Guidoom
Guidoom / gist:d5db0a76ce669b139271a528a8a2a27f
Last active October 30, 2024 10:05
Sample odoo.conf file
[options]
#
# WARNING:
# If you use the Odoo Database utility to change the master password be aware
# that the formatting of this file WILL be LOST! A copy of this file named
# /etc/odoo/openerp-server.conf.template has been made in case this happens
# Note that the copy does not have any first boot changes
#-----------------------------------------------------------------------------
# Odoo Server Config File - TurnKey Linux
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active August 16, 2024 13:39
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@dfrankland
dfrankland / odoo-server.conf
Last active January 28, 2018 14:40
Upstart script for OpenERP/Odoo on Ubuntu 14.04 (Should be placed in /etc/init/)
#!upstart
description "odoo-server"
start on runlevel [2345]
stop on runlevel [!2345]
#Respawn, with a limit of 10 times in a timespan of 90 seconds, after which it stops respawning.
respawn
respawn limit 10 90
@TannerRogalsky
TannerRogalsky / line.lua
Created March 23, 2014 15:37
Lightweight Ray Object
--[[
Copyright (c) 2014 Tanner Rogalsky
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active October 12, 2024 16:34
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>