Skip to content

Instantly share code, notes, and snippets.

View pmutua's full-sized avatar
🐲
Focus mode

Philip Mutua pmutua

🐲
Focus mode
View GitHub Profile
@tsaqib
tsaqib / install-odoo8.sh
Last active November 8, 2017 08:00
Installer script for Odoo 8 on Debian & Ubuntu VM/Azure
# Manually execute first: sudo -i
# Usage: wget -q -O - "$@" https://gist.githubusercontent.com/tsaqib/c8915096c7fde8ade3971ff51f764da7/raw/ --no-cache | sh
# After installation, codebase can be found at /usr/lib/python2.7/dist-packages/openerp
apt-get update -y && apt-get upgrade -y
wget http://nightly.odoo.com/extra/wkhtmltox-0.12.1.2_linux-jessie-amd64.deb
dpkg -i wkhtmltox-0.12.1.2_linux-jessie-amd64.deb
apt-get install -f
rm wkhtmltox-0.12.1.2_linux-jessie-amd64.deb
wget -O - https://nightly.odoo.com/odoo.key | apt-key add -
@pmutua
pmutua / multi-git.md
Created November 29, 2017 12:52 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer.

Setting up github and bitbucket on the same computer

Github will be the main account and bitbucket the secondary.

Create SSH Keys

ssh-keygen -t rsa -C "github email"

Enter passphrase when prompted. If you see an option to save the passphrase in your keychain, do it for an easier life.

@mdiener21
mdiener21 / install-pgadmin4-py3.sh
Last active December 26, 2017 23:03
install pgadmin4 desktop ubuntu 16
# original post http://askubuntu.com/questions/831262/how-to-install-pgadmin-4-in-desktop-mode-on-ubuntu-16-04
sudo apt-get install python3-venv python3-pip libpq-dev python3-dev
mkdir myVenvs
cd myVenvs
pyvenv pgadmin4-ve
source pgadmin4-v/bin/activate
wget https://ftp.postgresql.org/pub/pgadmin3/pgadmin4/v1.1/pip/pgadmin4-1.1-py3-none-any.whl
@itdaniher
itdaniher / bench.py
Created January 30, 2017 20:58
python-blosc / python-lz4 profiling
import uuid
import timeit
import lz4
import os
from timeit import Timer
import sys
import blosc
DATA = open(sys.argv[1], "rb").read()
LZ4_DATA = lz4.block.compress(DATA)
@pmutua
pmutua / test_image_upload.py
Created June 26, 2018 08:57 — forked from guillaumepiot/test_image_upload.py
Django Rest Framework - Image/File upload test
import os
import io
from PIL import Image
from django.core.urlresolvers import reverse
from django.conf import settings
from rest_framework import status
from rest_framework.test import APITestCase

In your models.py put:

from django.db import models

@classmethod
def model_field_exists(cls, field):
    try:
        cls._meta.get_field(field)
 return True

Installation of Phoenix on Ubuntu 16.04

  • Don't use the Ubuntu packages provided, instead:
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb 
sudo dpkg -i erlang-solutions_1.0_all.deb
sudo apt-get update
sudo apt-get install esl-erlang elixir
@oidualc
oidualc / fix-cordova-6.4.0-semver.patch
Last active December 11, 2020 23:59
Fix for semver error in cordova 6.4.0
--- a/platforms/android/cordova/lib/emulator.js 2018-08-08 12:34:38.000000000 +0200
+++ b/platforms/android/cordova/lib/emulator.js 2018-08-08 14:14:35.000000000 +0200
@@ -187,7 +187,7 @@
var api_level = avd.target.match(/\d+/);
if (api_level) {
var level = android_versions.get(api_level);
- avd.target = 'Android ' + level.semver + ' (API level ' + api_level + ')';
+ avd.target = 'Android ' + (level ? level.semver : '') + ' (API level ' + api_level + ')';
}
}
@audreyfeldroy
audreyfeldroy / gist:1095555
Created July 20, 2011 18:23
Django coverage walkthrough
Here is my django-coverage walkthrough. A nice minimal sample project showing django-coverage in action is https://github.com/pydanny/django-party-pack
1) Add to requirements.txt:
django-coverage==1.2
coverage==3.4
2) In your virtualenv, do a "pip install -r requirements.txt"
3) Add to settings.py:
@codingjoe
codingjoe / django_docs.md
Last active July 24, 2022 23:16
Build Django docs like a pro!

Build Django docs like a pro!

Sphinx config

docs/conf.py

import importlib
import inspect
import os
import sys