Skip to content

Instantly share code, notes, and snippets.

View tarunbhardwaj's full-sized avatar

Tarun Bhardwaj tarunbhardwaj

View GitHub Profile
@tarunbhardwaj
tarunbhardwaj / Openerp_partners
Created July 4, 2013 11:55
JS Bot to load all partners of OpenERP
/*
Run on https://www.openerp.com/partners/directory/
*/
var countries = Array();
$(".oe_countries ul li a").each(function(){
if ($(this).attr("href") != undefined)
countries.push({
"Link": $(this).attr("href"),
"Name": $(this).html(),
@tarunbhardwaj
tarunbhardwaj / travis_setup.py
Created August 9, 2013 08:41
Script to install package using .travis.yml
#!/usr/bin/env python
'''
Install package from .travis.yml
usage: travis_setup.py
@author Tarun Bhardwaj
@license FreeBSD Licence
'''
@tarunbhardwaj
tarunbhardwaj / tryton_shell.py
Last active December 21, 2015 10:39 — forked from vishesh/tryton_shell
A simple Tryton shell environment that initializes one database and config file for you. I intend to use to interact with models.Customized: You can directly start using tryton ORM
#!/usr/bin/env python
""" tryton_shell: A dirty shell for Tryton to quickly interact with it
usage: tryton_shell.py [-h] --config CONFIG --database DATABASE
arguments:
--config CONFIG Tryton config file.
--database DATABASE Tryton database.
@tarunbhardwaj
tarunbhardwaj / Jinja-static-site.py
Last active December 9, 2015 06:28
Render JInja template as static site using Flask
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Jinja2 static site renderer using Flask
@author Tarun Bhardwaj
@license FreeBSD Licence
"""
from flask import Flask, abort, render_template
from jinja2 import TemplateNotFound
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options
This script set ownership for all table, sequence and views for a given database
Credit: Based on http://stackoverflow.com/a/2686185/305019 by Alex Soto
@tarunbhardwaj
tarunbhardwaj / setup-sftp-chroot.md
Created February 13, 2016 22:11
Setup sftp with chroot

Setup SFTP with chroot

  1. Create folder to chroot mkdir /opt/sftp

  2. Change ownership chown root:root /opt/sftp

  3. Change mode chmod go-w /opt/sftp

  4. Change sshd config /etc/ssh/sshd_config

@tarunbhardwaj
tarunbhardwaj / move-google-datastore.py
Created April 24, 2017 17:24
Move Google datastore data to different project or to different account
# -*- coding: utf-8 -*-
"""
move_google_datastore
Move google datastore data to different project / different account.
:license: MIT
"""
from google.cloud import datastore
from google.cloud.datastore.entity import Entity
@tarunbhardwaj
tarunbhardwaj / fix-virtualenv.sh
Last active June 16, 2018 03:54
Fix broken python links in venv
# Fix borken python links in all venv
cd ~/.virtualenvs
for i in `workon`
do
if [ $(find $i/ -type l | tail -n 1 | grep "python3") ]; then
echo "$i python3"
find $i/ -type l -delete
virtualenv $i --python=python3