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 — forked from irogers/auth.py
Google Services
from dataclasses import dataclass
@dataclass
class ServiceAccountInfo:
private_key: str
client_email: str
token_uri: str
@tejastank
tejastank / index.php
Created January 23, 2016 11:58 — forked from samt/index.php
<?php
require __DIR__.'/includes/BarcodeBase.php';
require __DIR__.'/includes/QRCode.php';
require __DIR__.'/includes/DataMatrix.php';
require __DIR__.'/includes/PDF417.php';
require __DIR__.'/includes/Code39.php';
require __DIR__.'/includes/Code128.php';
$bcode = array();
@tejastank
tejastank / default.vcl_PREFACE.md
Created August 6, 2021 05:20 — forked from fevangelou/default.vcl_PREFACE.md
The perfect Varnish configuration for Joomla, WordPress & other CMS based websites

The perfect Varnish configuration for Joomla, WordPress & other CMS based websites

IMPORTANT: Read this before implementing one of the configuration files below (for either Varnish 3.x or 4.x+).

USE: Replace the contents of the main Varnish configuration file located in /etc/varnish/default.vcl (root server access required - obviously) with the contents of the configuration you'll use (depending on your Varnish version) from the 2 examples provided below.

IMPORTANT: The following setup assumes a 180 sec (3 minute) cache time for cacheable content that does not have the correct cache-control HTTP headers. You can safely increase this to 300 sec (or more) for less busier sites or drop it to 60 sec or even 30 sec for high traffic sites.

This configuration requires an HTTP Header and a user cookie to identify if a user is logged in a site, in order to bypass caching overall (see how it's done for Joomla & WordPress). If your CMS provides a way to add these two requirements, then you can use this configurati

@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('birisi@gmail.com'))
@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 kepsicsassasaa@hot.ee --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