Skip to content

Instantly share code, notes, and snippets.

View KangOl's full-sized avatar
📷
Screenshot Debugger

Christophe Simonis KangOl

📷
Screenshot Debugger
View GitHub Profile
#!/usr/bin/env python
import os
import sys
if len(sys.argv) > 1:
print os.getpid(), " ".join(sys.argv[1:])
else:
os.execv(sys.executable, [sys.executable] + sys.argv + ['hello', str(os.getpid())])
def get_fk_on(cr, table, ignored):
q = """ SELECT cl1.relname as table,
att1.attname as column
FROM pg_constraint as con, pg_class as cl1, pg_class as cl2,
pg_attribute as att1, pg_attribute as att2
WHERE con.conrelid = cl1.oid
AND con.confrelid = cl2.oid
AND array_lower(con.conkey, 1) = 1
AND con.conkey[1] = att1.attnum
@KangOl
KangOl / whoami.sh
Created December 28, 2012 18:43
Script that return the name of the current ssh user
#!/usr/bin/env bash
if [ -z "$SSH_TTY" ]; then
exit 3
fi
LOGINTIME=`last -RF ${SSH_TTY:5} | head -n1 | awk '{print $6}'`
MATCH=`echo $USER $SSH_CLIENT | awk '{print " Accepted publickey for " $1 " from " $2 " port " $3 " ssh2"}'`
@KangOl
KangOl / gist:4533912
Created January 14, 2013 21:58
imapfilter: auto sort mailing list
bool = function(o)
if not o then
return false
elseif o == '' then
return false
elseif o == 0 then
return false
elseif #o == 0 then
return false
end
=== modified file 'addons/web/static/src/js/chrome.js'
--- addons/web/static/src/js/chrome.js 2013-02-13 14:39:53 +0000
+++ addons/web/static/src/js/chrome.js 2013-02-19 22:08:07 +0000
@@ -1323,8 +1323,9 @@
},
on_hashchange: function(event) {
var self = this;
- var state = event.getState(true);
- if (!_.isEqual(this._current_state, state)) {
+ var stringstate = event.getState(false);
@KangOl
KangOl / openerp
Created July 5, 2013 09:38
openerp init.d script
#!/bin/bash
### BEGIN INIT INFO
# Provides: openerp
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start openerp daemon at boot time
# Description: Enable service provided by daemon.
# X-Interactive: true
@KangOl
KangOl / restore-db.sh
Last active November 16, 2016 10:11
restore-db.sh
#!/usr/bin/env bash
# set -x
set -e
set -o pipefail
if [[ -z "$1" ]];then
echo "Usage: $0 [-k] DB [TO]" >&2
exit 1
fi;
# install the editorconfig plugin for your editor: http://editorconfig.org/#download
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
#!/usr/bin/env bash
set -e -x
pushd "$(git rev-parse --show-toplevel)"
# remove empty directories
find . \( -name "*.~?~" -or -name "*.pyc" -or -name "*.pyo" -or -name "*.orig" -or -name "*.rej" \) -delete
find . -not -path './.git/*' -a -type d -empty -delete
# remove po for removed modules
for D in addons openerp/addons odoo/addons .; do
@KangOl
KangOl / _install.md
Last active February 15, 2024 15:01
Change OPW tag to links to the ticket