Skip to content

Instantly share code, notes, and snippets.

@stefanfoulis
stefanfoulis / osx_developer_installation.rst
Last active June 17, 2024 17:46
Instructions on how to setup an OSX developer machine for (python/django) development

OSX Developer System installation

This guide assumes a fresh install of Mac OSX 10.7 Lion.

Brew User

@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:
@gregburek
gregburek / rateLimitDecorator.py
Created December 7, 2011 01:51
Rate limiting function calls with Python Decorators
import time
def RateLimited(maxPerSecond):
minInterval = 1.0 / float(maxPerSecond)
def decorate(func):
lastTimeCalled = [0.0]
def rateLimitedFunction(*args,**kargs):
elapsed = time.clock() - lastTimeCalled[0]
leftToWait = minInterval - elapsed
if leftToWait>0:
@stevenou
stevenou / GeolocationModule.mm
Created February 14, 2012 21:15
Geofencing in Titanium
// this file located in /Library/Application Support/Titanium/mobilesdk/osx/{version_number}
// add the following methods to GeolocationModule.mm
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{
NSDictionary *event = [NSDictionary dictionaryWithObjectsAndKeys:NUMBOOL(YES),@"success",[NSDictionary dictionaryWithObjectsAndKeys:NUMDOUBLE(region.center.latitude),@"lat",NUMDOUBLE(region.center.longitude),@"lng",NUMDOUBLE(region.radius),@"radius",region.identifier,@"identifier",nil],@"region",nil];
if ([self _hasListeners:@"enteredRegion"])
{
[self fireEvent:@"enteredRegion" withObject:event];
@leolimajr
leolimajr / os-x-enable-trim.txt
Created November 21, 2012 11:10 — forked from clarencesong/os-x-enable-trim.md
Enable TRIM in OS X 10.8.2 for IOAHCIBlockStorage version 2.3.1
Enable TRIM on non-Apple SSDs in OS X 10.8.2 Mountain Lion.
WARNING: This is ONLY tested on 10.8.2 (IOAHCIBlockStorage version 2.3.1), and NOT earlier or later versions.
Check /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/version.plist
Technical note: The driver changed in 10.8.2 and similar perl commands that worked in earlier OS X versions did not work for me once I updated to 10.8.2.
Run the following commands in Terminal…
@ericmoritz
ericmoritz / README.md
Last active December 17, 2015 14:19
attempt to find a easy to say domain

I wanted to find a domain that could easily be spelled without confusion.

@jasonkneen
jasonkneen / 1readme.md
Last active May 28, 2021 16:48
Quick example of registering a URLScheme in a Titanium app using the TiApp.xml without info.plist file. Just add the following into your TiApp.xml (I put it under the </iphone> tag. Works on Android and iOS.

Quick Example of registering a scheme in TiApp.xml, implementing the code in app.js / alloy.js

@ericmoritz
ericmoritz / .gitignore
Last active December 18, 2015 09:28
Explaining monads without using the work monad.
*.pyc
@jerivas
jerivas / Mezzanine deployment.md
Last active August 29, 2015 14:15
HOWTO: Deploy a Mezzanine site

[CASE 1] Deploying to a brand new server:

  1. Get your sever. Anything that grants you root access works. VPS's like those from Digital Ocean work great and are cheap.
  2. Fill the FABRIC dictionary in local_settings.py. For SSH_USER provide any username you want (not root), and the fabfile can create it for you.
  3. Run fab secure. You simply need to know the root password to your VPS. The new user will be created and you can SSH with that from now on (if needed).
  4. Run fab all. It will take a while, but after this your Mezzanine site will be live.

Notice that not even once you had to manually SSH into your VPS. Note: some server providers need you to login as root once to change the default password they give you. It should be the only time you are required to SSH into the sever.

[CASE 2] If you already have a server, and you already have created a non-root user with sudo privileges:

@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm