Skip to content

Instantly share code, notes, and snippets.

View razvanioan's full-sized avatar

Razvan Ioan Anastasescu razvanioan

View GitHub Profile
@razvanioan
razvanioan / multipleImageContentReader.js
Created April 15, 2024 04:07 — forked from resistancecanyon/multipleImageContentReader.js
Reading Multiple Image Base64 data using Es6 Async/Await in a html:type:file input
// html
// <input type="file" onchange="imagesSelected" multiple accept=".gif,.jpg,.jpeg,.png" />
async function imagesSelected(event) {
let files = [...event.target.files];
let images = await Promise.all(files.map(f=>{return readAsDataURL(f)}));
//all images' base64encoded data will be available as array in images
}
function readAsDataURL(file) {
@razvanioan
razvanioan / postgres app multiple versions.md
Created January 2, 2023 15:13 — forked from ziaulrehman40/postgres app multiple versions.md
Using multiple postgresql version with appropoiate psql and other pg tools version on mac with postgresapp

Using multiple postgresql version with appropoiate psql and other pg tools version on mac with postgresapp

First make sure no postgres instance is configured to run on startup. And you get nothing when you run this command: which -a psql This is to make sure you don't have anything related to postgres in your PATH, which can conflict. If you do get some hits with above command, you have to manually either remove the installed versions of postgres or just fix PATH and remove ref to that path which has these binaries(psql, pg_dump etc)

For me, i was using brew installed postgres, i had to just comment out a PATH editing line which was inserted by brew in my .bash_profile

Ok, after this we are ready. Now things are simple:

@razvanioan
razvanioan / vimeo-download.py
Last active September 1, 2022 13:01 — forked from alexeygrigorev/vimeo-download.py
Downloading segmented video from vimeo
import requests
import base64
from tqdm import tqdm
master_json_url = 'https://109vod-adaptive.akamaized.net/exp=1662040711~acl=%2Fbc4b6790-2eb0-46e2-a2b4-6396b03d7ba4%2F%2A~hmac=b43d7d0ed71e01041955fb7559ec6230b4aaea55ef2b8a794f6abf4b1e319916/bc4b6790-2eb0-46e2-a2b4-6396b03d7ba4/sep/video/40079aa2,6e220c50,db93bcf5,7e658976,3f44d6fe/audio/9f9f9d50,ff94feee/master.json?query_string_ranges=1&base64_init=1'
base_url = master_json_url[:master_json_url.rfind('/video/') + 7]
resp = requests.get(master_json_url)
content = resp.json()

Odoo - Rename an addon without losing data

Rename addon

  • Change __openerp__.py addon name field
  • Change README.rst file
@razvanioan
razvanioan / stock_move.py
Created November 5, 2021 17:31 — forked from ahmedelbougha/stock_move.py
Example of Odoo Multi-Threading - Background Process
from odoo import api, fields, models
from odoo.tools import float_is_zero
from odoo.exceptions import UserError, ValidationError
import threading
import time
import logging
class StockMove(models.Model):
_inherit = 'stock.move'
@razvanioan
razvanioan / controller.py
Created November 5, 2021 15:09 — forked from hoangpq/controller.py
Odoo Asyncio Example
# -*- coding: utf-8 -*-
from odoo import http
import aiohttp
import asyncio
import time
import json
async def get_json(client, url):
@razvanioan
razvanioan / markdown-to-email
Created February 17, 2021 04:54 — forked from cleverdevil/markdown-to-email
markdown-to-email A simple script to send beautifully formatted emails that you write in Markdown. The email will have an HTML payload and a plain-text alternative, so you'll make everyone happy, including yourself.
#!/usr/bin/env python
'''
Send an multipart email with HTML and plain text alternatives. The message
should be constructed as a plain-text file of the following format:
From: Your Name <your@email.com>
To: Recipient One <recipient@to.com>
Subject: Your subject line
---