Skip to content

Instantly share code, notes, and snippets.

View simahawk's full-sized avatar

Simone Orsi simahawk

View GitHub Profile
@simahawk
simahawk / jira_board_filter_bookmarklet.js
Last active January 12, 2023 09:22
JIRA board search project bookmarklet
/**
Adds a search input to JIRA board quick filters to search for a project.
Installation: copy the snippet into a bookmark.
Usage: click on the bookmark while on a JIRA board.
Behavior: type a project name and hit enter.
If a proj is found on the page the others will be hidden.
To restore all the projects, wipe the text and hit enter.
@simahawk
simahawk / gist:9138b5865e2b732531e785d355c2dcb7
Created June 19, 2020 12:38
attempt to find direct method on odoo component
def _check_class_direct_func(instance, func_name):
"""Check if given instance class has defined a specific function directly."""
# TODO: this should work on normal python classes but not on components.
# if func_name in vars(instance.__class__):
# return inspect.isfunction(vars(instance.__class__)[func_name])
# FIXME this is not working either because:
# (Pdb++) instance.__class__
# <class 'odoo.addons.component.core.sftp.adapter'>
@simahawk
simahawk / csv2xml4odoo.py
Created March 9, 2020 08:57 — forked from bealdav/csv2xml4odoo.py
Odoo csv / xml converter
# -*- coding: utf-8 -*-
# based on this code
# http://code.activestate.com/recipes/577423-convert-csv-to-xml/
# convert Odoo csv files in xml files
# csv is easy to maintain but xml data have noupdate feature
# Limitations:
# - relation field One2many is NOT supported
# - csv should have 'id' as first column
@simahawk
simahawk / .coveragerc
Last active February 12, 2019 11:13
Odoo simple local setup via pip (example for cms repo)
[run]
omit =
*/tests/*
*__manifest__.py
[pytest]
filterwarnings =
error
ignore::DeprecationWarning
@simahawk
simahawk / recaptcha.js
Last active January 4, 2019 10:38
odoo website recaptcha improvements
/* Copyright 2016-2017 LasLabs Inc.
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/
odoo.define('website_form_recaptcha.recaptcha', function (require) {
"use strict";
var ajax = require('web.ajax');
var snippet_animation = require('website.content.snippets.animation');
var form_builder_send = snippet_animation.registry.form_builder_send;
@simahawk
simahawk / broadcaster.py
Created December 4, 2017 18:28
python icecast source streamer
# -*- coding: utf-8 -*-
# Inspired by https://github.com/turlando/airhead/blob/master/airhead/broadcaster.py
import click
import os
import shouty
import sys
import logging
logger = logging.getLogger('[broadcaster]')
@simahawk
simahawk / remove-docker-containers.md
Created November 21, 2017 09:53 — forked from ngpestelos/remove-docker-containers.md
How to remove unused Docker containers and images
  1. Delete all containers

     $ docker ps -q -a | xargs docker rm
    

-q prints only the container IDs -a prints all containers

Notice that it uses xargs to issue a remove container command for each container ID

  1. Delete all untagged images
@simahawk
simahawk / json.xsl
Created August 14, 2017 17:17
Icecast server JSON status
# place this into /usr/share/icecast2/web/json.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output omit-xml-declaration="yes" method="text" indent="no" media-type="text/javascript" encoding="UTF-8"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/icestats">{
<xsl:for-each select="source">
"<xsl:value-of select="@mount"/>":{
"server_name":"<xsl:value-of select="server_name"/>",
"listeners":"<xsl:value-of select="listeners"/>",
"description":"<xsl:value-of select="server_description"/>",
@simahawk
simahawk / link_it.py
Last active August 15, 2017 17:31
Odoo backend link for existing record model
@simahawk
simahawk / example.sh
Created March 6, 2017 10:29
replace Windows carriage return "^M"
sudo apt-get install dos2unix
dos2unix -n path/to/file path/to/file