Skip to content

Instantly share code, notes, and snippets.

View tejastank's full-sized avatar

Tejas Tank tejastank

View GitHub Profile
@tejastank
tejastank / example_model.py
Created October 19, 2023 10:27 — forked from danmana/example_model.py
Add support for custom json fields in Odoo
from odoo import models, fields, api
from json_field import JsonField
class Person(models.Model):
_name = 'example.person'
_description = 'Person with json details'
details = JsonField() # a json object represented as dict / list / python primitives
@tejastank
tejastank / auth.py
Created October 5, 2023 10:51
Google Services
from dataclasses import dataclass
@dataclass
class ServiceAccountInfo:
private_key: str
client_email: str
token_uri: str
@tejastank
tejastank / powerbi-postgres-cert-steps.md
Created June 19, 2023 07:27 — forked from oeon/powerbi-postgres-cert-steps.md
Steps covering new Postgres-SSL cert creation and import into Windows for connecting to PowerBI.

Essentially, the problem is that the default SSL cert for Postgres /etc/ssl/certs/ssl-cert-snakeoil.pem does not have enough information when copied over to the Guest machine running PowerBI which is trying to connect to Postgres, specifically, the Common Name field.

There are various posts out there about this e.g. https://community.powerbi.com/t5/Desktop/PostgreSQL-powerbi-desktop-connection-error/m-p/90689. This one was good to point me at npgsql 3.1.8 specifically https://blogs.msdn.microsoft.com/chmitch/2018/06/04/complete-guide-to-setting-up-power-bi-connecting-to-postgres-w-refresh-enabled/

  1. create a new SSL certificate (roughly) following these guides: https://uit.stanford.edu/service/ssl/selfsigned + https://www.postgresql.org/docs/9.1/static/ssl-tcp.html be sure to set the Common Name field value to the IP address of the server which is hosting the Postgres instance you're connecting to from PowerBI. -days 3650 will set the expiration in 10 years, default is 30 days if not specified.
import unittest
from validators import validate_email
class ValidatorsTestCase(unittest.TestCase):
def test_validate_email(self):
# Bu format kesinlikle doğru.
self.assertTrue(validate_email('[email protected]'))
@tejastank
tejastank / check.py
Created August 7, 2022 06:46 — forked from kepsic/check.py
#!/usr/bin/env python3
"""
DESCRIPTION
Email checker
INSTALL
sudo apt-get install python3-pip
pip3 install validate_email
pip3 install py3DNS
chmod 755 check.py
./check.py --validate [email protected] --debug
import cv2
import imutils
import numpy as np
import pytesseract
from PIL import Image
pytesseract.pytesseract.tesseract_cmd = 'C:\Program Files (x86)\Tesseract-OCR\tesseract.exe'
path = r'C:\Program Files (x86)\Tesseract-OCR\7.jpg'
# Using cv2.imread() method
img = cv2.imread(path)
@tejastank
tejastank / learning.md
Created December 8, 2021 05:48 — forked from 0-vortex/learning.md
Some interesting machine learning and artificial intelligence paper demos
@tejastank
tejastank / gcp.py
Created October 21, 2021 09:54 — forked from leviathan747/gcp.py
Python script for submitting Google Cloud Print jobs from macOS native print dialog using PDF Services.
#!/usr/local/bin/python3
# This script can be used to submit Google Cloud Print jobs from the PDF services menu in macOS
#
# Prerequisites:
# - Python 3.x
# - oauth2client installed
#
# Setup instructions:
# 1. Clone this gist into a directory called ".gcp" in your home directory. Assure
@tejastank
tejastank / install-modoboa-opensuse.sh
Created October 14, 2021 06:50 — forked from jniltinho/install-modoboa-opensuse.sh
Install Modoboa Webmail Python on OpenSUSE 12.3
#!/bin/bash
## Install Modoboa Webmail Python on OpenSUSE 12.3
## Author: Nilton OS www.linuxpro.com.br
# Check if user has root privileges
if [[ $EUID -ne 0 ]]; then
echo "You must run the script as root or using sudo"
exit 1
fi