Skip to content

Instantly share code, notes, and snippets.

@kerbrose
kerbrose / read_xlsx.py
Created March 2, 2017 12:55
this how to read all files with type in python 3
# reading all files with type xlsx
import os, fnmatch
rootdir = '~/' # your root path
for subdir, dirs, files in os.walk(rootdir):
for file in files:
if fnmatch.fnmatch(file, '*.xlsx'):
print(os.path.join(subdir, file))
from openpyxl import load_workbook
target_directories = [file_names]
for wb_loc in target_directories:
print(wb_loc, " : ", " : ", " : ")
wb = load_workbook(wb_loc, read_only = True)
for sheet in wb:
print("SHEET TITLE", " : ", sheet.title, " : ", "SHEET MAX ROWS", " : ", sheet.max_row)
for index, current_row in enumerate(sheet.iter_rows()):
import csv
import odoorpc
odoo = odoorpc.ODOO('localhost', port=8070)
odoo.login('progate_07032017', 'admin', 'admin')
move_obj = odoo.env['account.move']
with open('my_cs.csv', newline='') as csvfile:
odoo = odoorpc.ODOO('localhost', port=8070)
odoo.login('progate_07032017', 'admin', 'admin')
sudo apt install adduser libldap2-dev libsasl2-dev libssl-dev libxml2-dev libxslt1-dev node-less npm postgresql postgresql-client Postgresql-server-dev-9.5 python python-dev \
python-babel python-dateutil python-decorator python-docutils python-feedparser python-gevent python-imaging \
python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid python-passlib \
python-psutil python-psycopg2 python-pychart python-pydot python-pyparsing python-pypdf python-reportlab \
python-requests python-suds python-tz python-vatnumber python-vobject python-werkzeug python-xlsxwriter python-xlwt python-yaml
@kerbrose
kerbrose / odoo.cfg
Last active April 23, 2020 16:44
save odoo config file
odoo.py --save --config myodoo.cfg --stop-after-init
./odoo-bin -c myodoo.cfg
sudo su - postgres -c "createuser -s $USER"
## https://unix.stackexchange.com/questions/13751/kernel-inotify-watch-limit-reached
cat /proc/sys/fs/inotify/max_user_watches
echo "fs.inotify.max_user_watches=524288" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
@kerbrose
kerbrose / search.ps
Created July 6, 2017 01:04
how to use powershell for file search
Get-ChildItem -Path C:\ -Name -Filter *<NAME WHAT YOU WANT>*.<EXTENTION> -Recurse -ErrorAction SilentlyContinue -Force
@kerbrose
kerbrose / odt2txt.sh
Created July 25, 2017 12:19
simple script to convert odt
for f in *.odt
do
echo "converting file - $f"
odt2txt $f > $f.txt
done
@kerbrose
kerbrose / wildcard.sh
Last active April 19, 2020 13:37
Wildcard subdomains with dnsmasq
sudo apt-get install dnsmasq
echo "address=/localhost/127.0.0.1" > /etc/dnsmasq.d/localhost.conf
echo "prepend domain-name-servers 127.0.0.1;" >> /etc/dhcp/dhclient.conf
sudo systemctl restart dnsmasq.service
sudo dhclient
# non systemd
/etc/init.d/dnsmasq restart
@kerbrose
kerbrose / Get-VideoDetails.ps1
Last active April 6, 2018 05:29
this script will help you to get duration of video in the directory
Function Get-VideoDetails {
param ($targetDirectory)
$LengthColumn = 27
$objShell = New-Object -ComObject Shell.Application
$total_duration = [timespan] '00:00:00'
Get-ChildItem -LiteralPath $targetDirectory -Include *.mp4 -Recurse -Force | ForEach {
if ($_.Extension -eq ".mp4"){
$objFolder = $objShell.Namespace($_.DirectoryName)
$objFile = $objFolder.ParseName($_.Name)