Skip to content

Instantly share code, notes, and snippets.

View macagua's full-sized avatar
🏠
Working from home

Leonardo J. Caballero G. macagua

🏠
Working from home
View GitHub Profile
@sehrishnaz
sehrishnaz / gmail_python_bot.py
Last active February 1, 2022 19:01
Send Bulk Email From Python Using Cloud Console Gmail API - Python Gmail Bot
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from email.mime.text import MIMEText
import base64
import pandas as pd
import random
import time
@sehrishnaz
sehrishnaz / auto_post_facebook_bot_using_python.py
Created November 22, 2021 10:42
Automate Facebook Post to Groups using Graph API and Python
import json
from facebook import GraphAPI
import pandas as pd
import time
import secrets
import random
def read_creds(filename):
'''
Store API credentials in a safe place.
@sehrishnaz
sehrishnaz / facebook_bot_using_python.py
Created November 22, 2021 10:22
Automate Facebook Post to Groups using Graph API and Python
import json
from facebook import GraphAPI
import pandas as pd
import time
import secrets
import random
def read_creds(filename):
'''
Store API credentials in a safe place.
import streamlit as st
import requests
def fetch(session, url):
try:
result = session.get(url)
return result.json()
except Exception:
return {}
@sehrishnaz
sehrishnaz / hide_export_option_from_more_menu_odoo.xml
Created October 13, 2021 09:43
Hide or Remove Export Option From More Menu Button in Odoo
<templates>
<t t-extend="Sidebar">
<t t-jquery="a.oe_sidebar_action_a" t-operation="replace">
<t t-if="widget.session.uid !== 1">
<a t-if="item.label !== 'Export'" class="oe_sidebar_action_a" t-att-title="item.title or ''" t-att-data-section="section.name" t-att-data-index="item_index" t-att-href="item.url" target="_blank">
<t t-raw="item.label"/>
</a>
</t>
<t t-if="widget.session.uid === 1">
<a class="oe_sidebar_action_a" t-att-title="item.title or ''" t-att-data-section="section.name" t-att-data-index="item_index" t-att-href="item.url" target="_blank">
@nzambello
nzambello / update-dvt.sh
Created August 30, 2021 14:31
Update DVT
#!/bin/bash
echo -n "Enter design-volto-theme version: "
read -r dvtVersion
npx purge-lockfile@latest volto && rm -rdf node_modules && yarn cache clean && yarn add "redturtle/design-volto-theme#v$dvtVersion" -W && yarn i18n && git commit -am "chore(upd8): update dvt v$dvtVersion" && rm -rdf node_modules && yarn install --frozen-lockfile
from PyPDF2 import PdfFileWriter, PdfFileReader
# https://stackoverflow.com/questions/490195/split-a-multi-page-pdf-file-into-multiple-pdf-files-with-python#490203
def pdf_split(fname, start, end=None):
print('pdf_split', fname, start, end)
# pdf_split ~/Downloads/4-27-files/Invoice Email-0.pdf 1 4
#inputpdf = PdfFileReader(open("document.pdf", "rb"))
inputpdf = PdfFileReader(open(fname, "rb"))
@michaelkarrer81
michaelkarrer81 / doodba_cheatsheet.md
Last active September 22, 2022 14:27
[doodba tools] doodba tools and commands #doodba #odoo #docker #invoke #pre-commit

Invoke

Invoke is a Python task execution tool & library. Following the lead of most Unix CLI applications, it offers a traditional flag-based style of command-line parsing, deriving flag names and value types from task signatures (optionally, of course!). Like many of its predecessors, it offers advanced features as well – namespacing, task aliasing, before/after hooks, parallel execution and more.

Get more information at pyinvoke.org

# List all tasks invoke can find in the current direktory (from tasks.py)
invoke --list
# Only show commands that would be executed by called task(s) (dry run)
apiVersion: v1
kind: ConfigMap
metadata:
name: odoo-conf
data:
web: |
[options]
server_wide_modules = web
max_cron_threads = 0