Skip to content

Instantly share code, notes, and snippets.

View mikelopez's full-sized avatar

Marcos Lopez mikelopez

View GitHub Profile
@mikelopez
mikelopez / testrunner.py
Created January 3, 2013 21:43
Custom test runner using no databases Requires DEV_INSTALLED_APPS present in settings. modify this if you need
__author__ = 'Marcos Lopez'
# http://github.com/mikelopez
from django.test.simple import DjangoTestSuiteRunner
import settings
class BaseAppsTestNoDb(DjangoTestSuiteRunner):
def setup_databases(self, **kwargs):
""" override the db stuff from DjangoTestSuiteRunner """
pass
@mikelopez
mikelopez / AweberApiWrapper.py
Created February 22, 2013 05:42
subclassing the AWeber class and binding to database objects
from aweber_api import AWeberAPI
class AWeberWrapper(AWeberAPI):
""" interface between aweber_api and our database objects """
_w_access_key = None
_w_access_secret = None
_w_consumer_key = None
_w_consumer_secret = None
_w_obj = None
_w_account = None
@mikelopez
mikelopez / reboot-to-chrome.sh
Created March 28, 2013 04:51
Use this small shell command to set ChromeOS back as your default OS on your dual OS Chromebook. Tested on Acr C7 Chromebook following the setup guide: http://arstechnica.com/gadgets/2012/12/how-to-install-ubuntu-on-acers-199-c7-chromebook/
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
cgpt add -i 6 -P 0 -S 1 /dev/sda && reboot
@mikelopez
mikelopez / reboot-to-ubuntu.sh
Last active December 15, 2015 12:29
Use this small shell command to set Ubuntu back as your default OS on your dual OS Chromebook. Tested on Acr C7 Chromebook following the setup guide: http://arstechnica.com/gadgets/2012/12/how-to-install-ubuntu-on-acers-199-c7-chromebook/
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
cgpt add -i 6 -P 5 -S 1 /dev/sda && reboot
// use dev-port 3000
var express = require('express');
var http = require('http');
var Browser = require('zombie');
var assert = require('assert');
var settings = require('../globalsettings');
var app = require('../app');
describe('Starting server and testing client urls...', function() {
@mikelopez
mikelopez / statesdata.py
Created May 16, 2013 11:46
python dictionary of United States. key = state abbrev. code and value = full state name
states = {
'AK': 'Alaska',
'AL': 'Alabama',
'AR': 'Arkansas',
'AS': 'American Samoa',
'AZ': 'Arizona',
'CA': 'California',
'CO': 'Colorado',
'CT': 'Connecticut',
'DC': 'District of Columbia',
@mikelopez
mikelopez / gist:5606887
Created May 19, 2013 06:31
updated keys for esl.ini
[ CONTROLS ]
Toggle_LSTG = 97 // J by default
Toggle_SECL = 98 // K by default
Toggle_WRNL = 99 // L by default
Toggle_SRN = 100 // H by default
Toggle_InfoPanel = 101 // M by default **
Toggle_Hazlights = 0 // Nothing/disabled by default **
Toggle_Takedowns = 221 // ] by default
Toggle_Cruise = 219 // [ by default
Chng_Pat_PRML = 85 // U by default *
@mikelopez
mikelopez / gist:5700903
Created June 3, 2013 20:01
Apache configuration for node.js sites - requires mod_http, mod_proxy_http for apache2
<VirtualHost 192.168.1.10:80>
ServerAdmin dev@scidentify.info
ServerName scidentify.info
ServerAlias www.scidentify.info
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
@mikelopez
mikelopez / gist:6032675
Created July 18, 2013 20:16
rfind exceptions
LOG :: 2013-07-18 15:15:37,533 ERROR Internal Server Error: /
---
Traceback (most recent call last):
File "/Library/Python/2.6/site-packages/Django-1.4.1-py2.6.egg/django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/Library/Python/2.6/site-packages/Django-1.4.1-py2.6.egg/django/contrib/auth/decorators.py", line 19, in _wrapped_view
if test_func(request.user):
File "/Library/Python/2.6/site-packages/Django-1.4.1-py2.6.egg/django/contrib/auth/decorators.py", line 42, in <lambda>
lambda u: u.is_authenticated(),
@mikelopez
mikelopez / gist:6117304
Created July 30, 2013 21:47
sample code for .net asterisk ami originating calls and tracing taken from http://caruizdiaz.com/?p=247 and fixed indenting
public class Dialer
{
ManagerConnection _managerConnection;
Timer _timer;
public delegate void CallFinalizedCallback(Dialer sender);
string _uniqueID = string.Empty;
bool _wasOriginated = false;
object _locker = new object();
List<HangupEvent> _hangupList = new List<HangupEvent>();