Skip to content

Instantly share code, notes, and snippets.

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

N37R09U3 n37r06u3

🏠
Working from home
  • China
View GitHub Profile
@bistaray
bistaray / odoo_install.sh
Last active April 15, 2022 02:51
Install Odoo v10 Enterprise (with Bista repositories)
#!/bin/bash
################################################################################
# Script for installing Odoo V10 on Ubuntu 16.04, 15.04, 14.04
# Author: Yenthe Van Ginneken
# Adjusted: Ray Carnes
# Assumes you already have an Ubuntu user called "odoo" with a home folder
#-------------------------------------------------------------------------------
# Make a new file:
# sudo nano odoo-install.sh
# Place this content in it and then make the file executable:
@ryanc-me
ryanc-me / odoo.conf
Last active September 26, 2020 22:51
Sample Odoo/Nginx Config (with dbfilter_from_header support)
# Author: Ryan Cole
# Website: https://ryanc.me
# GitHub: https://github.com/MGinshe
# Usage:
# Place this file in /etc/nginx/sites-enabled/
# Make sure you edit the DOMAIN_HERE and SSL_CERTIFICATE, and DB_FILTER sections
#
# Note: This config file is designed to be used with the Odoo dbfilter_from_header module
# https://apps.openerp.com/apps/modules/9.0/dbfilter_from_header/
@vhanla
vhanla / buildchmlibandinstallpychm.cmd
Created September 2, 2016 10:05
Build CHMlib on Windows and also PyCHM setup fix
@echo off
rem author: vhanla
rem If you want to install PyChm on Python (2.7) in Windows (32bits), you might get stuck on errors by trying to build using
rem Microsoft Visual C++ Compiler Package for Python 2.7 because it won't be capable to build chmlib (chm.lib)
rem So to fix that you need to build it manually, but here is a batch that will built it and setup automatically:
set currentdir=%~dp0
if exist "%CD%\chmlib\" goto building
goto gitchmlib
@shingonoide
shingonoide / cleanup_odoo_session.sh
Last active August 30, 2023 14:27
Simple script to clean up Odoo session files
#!/bin/sh
# example
# add this to crontab -e of odoo user
# curl -sL https://gist.github.com/shingonoide/1947a97e3c00168372e950a6788ce9ad/raw/cleanup_odoo_session.sh > /tmp/cleanup_sessions.sh && sh /tmp/cleanup_sessions.sh 4
HOW_OLDER=${1:-6}
VERBOSE=${2:-0}
SESSION_FOLDER="$HOME/.local/share/Odoo/sessions"
TOTALFILES=$(find $SESSION_FOLDER -name '*.sess' | wc -l)

ffmpeg Cheatsheet

  • Join TS Files
  • Convert TS to MP4
  • Download Online AES-128 Encrypted HLS video
  • Convert Video to GIF
  • Extract Audio and Convert it to MP3
  • Burn Subtitles into Video

Join TS Files

@jgillman
jgillman / restore.sh
Last active March 8, 2024 17:51
pg_restore a local db dump into Docker
# Assumes the database container is named 'db'
DOCKER_DB_NAME="$(docker-compose ps -q db)"
DB_HOSTNAME=db
DB_USER=postgres
LOCAL_DUMP_PATH="path/to/local.dump"
docker-compose up -d db
docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}"
docker-compose stop db
#!/usr/bin/python
# -*- coding: utf-8 -*-
# utf-8 中文编码
import glob
import os,sys
import json
reload(sys)
sys.setdefaultencoding('utf-8')
import time, sys,iptc # iptc 包通过 sudo pip install python-iptables 安装
from datetime import datetime
@Grokzen
Grokzen / Symmetrical ManyToMany Filter Horizontal in Django Admin.py
Last active March 12, 2024 17:55
Symmetrical ManyToMany Filter Horizontal in Django Admin
# Based on post from: https://snipt.net/chrisdpratt/symmetrical-manytomany-filter-horizontal-in-django-admin/#L-26
# Only reposting to avoid loosing it.
"""
When adding a many-to-many (m2m) relationship in Django, you can use a nice filter-style multiple select widget to manage entries. However, Django only lets you edit the m2m relationship this way on the forward model. The only built-in method in Django to edit the reverse relationship in the admin is through an InlineModelAdmin.
Below is an example of how to create a filtered multiple select for the reverse relationship, so that editing entries is as easy as in the forward direction.
IMPORTANT: I have no idea for what exact versions of Django this will work for, is compatible with or was intended for.
@ldct
ldct / postgres.sh
Last active September 13, 2018 07:26
postgres 9.6 ubuntu 15.04
sudo apt-get install git build-essential curl xclip
sudo apt-get install bison flex libreadline-dev libz-dev
git clone git://git.postgresql.org/git/postgresql.git
cd postgresql; ./configure; make; sudo make install
cd contrib; make; sudo make install
sudo adduser postgres
sudo mkdir /usr/local/pgsql/data
sudo chown postgres -R /usr/local/pgsql/data