Skip to content

Instantly share code, notes, and snippets.

View nicolasmendoza's full-sized avatar
🎯
Focusing

Nicolás nicolasmendoza

🎯
Focusing
  • 15:17 (UTC -05:00)
View GitHub Profile
@nicolasmendoza
nicolasmendoza / Readme.rst
Last active November 2, 2015 00:27
Installing Redis on Ubuntu (Documentation)

Installing redis-server

Updating System

  1. $ sudo apt-get update
  2. $ sudo apt-get install build-essential
  3. $ sudo apt-get install tcl8.5
@nicolasmendoza
nicolasmendoza / iceWMdual.mkd
Created November 1, 2015 04:54 — forked from bxt/iceWMdual.mkd
IceWM Dual Screen expanding howto (very basic)

Step 1: Make sure xrandr works fine

Check your screen's names by typing:

xrandr -q

Step 2: Expand your screen

Then disable one of them: (notice VGA-1 is the name of the screen, will differ, e.g. HDMI-1 if the screen is connected via HDMI)

@nicolasmendoza
nicolasmendoza / remove.sh
Last active September 7, 2015 20:28 — forked from icaoberg/remove.sh
[Git] Remove all *.pyc files from your git repository
#!/bin/bash
find . -name "*.pyc" -exec git rm {} \;
git commit -m "Removed compiled python files in distribution left after last commit"
#!/bin/bash
# Script author: MrVaykadji http://askubuntu.com/users/176689/mrvaykadji
# Changes made by Ribtoks
# - simulink for compass2.0 in /usr/bin/
# - replaced apt commands with zypper commands
# Changes made by Andrew <andrew@webupd8.org>:
# - use the NodeJS PPA to avoid build failure with grunt-cli
# - use the Popcorn Time icon
# - added check for apt, dpkg, etc.
# - added some checks when creating symbolic links

This document has now been incorporated into the uWSGI documentation:

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

@nicolasmendoza
nicolasmendoza / 39 de 1.327 Be careful deleting files around gi
Created May 5, 2015 18:06
39 de 1.327 Be careful deleting files around gi
Working in a Python project, it's common to have a clean-up step that deletes all the .pyc files, like this:
$ find . -name '*.pyc' -delete
This works great, but there's a slight chance of a problem: Git records information about branches in files within the .git directory. These files have the same name as the branch.
Try this:
$ git checkout -b cleaup-all-.pyc
@nicolasmendoza
nicolasmendoza / gist:6943df594e1d61ef8a6d
Last active August 29, 2015 14:20
Shell plus + django 1.7 + pycharm ...initialñ script
import sys
import django
django.setup()
from django.db.models import get_models
for _class in get_models():
globals()[_class.__name__] = _class
@nicolasmendoza
nicolasmendoza / gist:cc7c7f211214079f9f5b
Last active August 29, 2015 14:20
Adding shell plus + pycharm
import sys
import logging
logging.basicConfig(format="%(levelname)-8s %(asctime)s %(name)s %(message)s", datefmt='%m/%d/%y %H:%M:%S', stream=sys.stdout )
log = logging.getLogger("root")
from django.db.models import get_models
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
logging.config.dictConfig(settings.LOGGING)
@nicolasmendoza
nicolasmendoza / gist:7d3a6230f8262a947215
Created May 4, 2015 17:16
Default startup script django console pych
import sys; print('Python %s on %s' % (sys.version, sys.platform))
import django; print('Django %s' % django.get_version())
sys.path.extend([WORKING_DIR_AND_PYTHON_PATHS])
if 'setup' in dir(django): django.setup()
import django_manage_shell; django_manage_shell.run(PROJECT_ROOT)
import base64
"""
Some useful functions for interacting with Java web services from Python.
"""
def make_file_java_byte_array_compatible(file_obj):
"""
Reads in a file and converts it to a format accepted as Java byte array
:param file object