Skip to content

Instantly share code, notes, and snippets.

@adeleinr
adeleinr / gist:672140
Created November 11, 2010 07:12 — forked from anonymous/gist:156623
django deployment
"""
This fabric file makes setting up and deploying a django application much
easier, but it does make a few assumptions. Namely that you're using Git,
Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have
Django installed on your local machine and SSH installed on both the local
machine and any servers you want to deploy to.
_note that I've used the name project_name throughout this example. Replace
this with whatever your project is called._
@adeleinr
adeleinr / Django Features to explore
Created July 22, 2010 20:27
Django Features To Explore
Django Features to Explore
---------------------------
-a full-featured database API
-a built-in authentication and permissions system for user accounts
-"Generic views," which save you from having to write code for common things like date-based content archives
-a built-in cache system to help you squeeze every possible ounce of performance out of Django
-an internationalization system to make it easy to translate your application's interface into other languages
-easy, automatic generation of RSS feeds and Google sitemaps
-easy serialization of data to XML or JSON, for easy use with AJAX
plus a whole lot more
@adeleinr
adeleinr / Django Alias
Created July 19, 2010 18:04
Django Aliases
General
------------------------------------------------
alias django='cd /django/trunk/django/'
alias mysite='cd /projects/mysite'
alias start_fcgi='mysite; sudo python manage.py runfcgi host=127.0.0.1 port=8080 --settings=settings; cd -;'
alias stop_fcgi='mysite; sudo killall python manage.py; cd -;'
alias restart_fcgi='mysite; sudo killall python manage.py; sudo python manage.py runfcgi host=127.0.0.1 port=8080 --settings=settings; cd -;'
alias syncdb='mysite; sudo python manage.py syncdb; cd -;'
alias shell='mysite; sudo python manage.py shell; cd -;
@adeleinr
adeleinr / Network Troubleshooting
Created July 10, 2010 01:45
Network Troubleshooting CheatSheet
What to check if site is down
------------------------------
1) check that A record is pointing to vps IP. I this case A should be followed by an IP.
dig ddailygirl.com
; <<>> DiG 9.7.0-P1 <<>> ddailygirl.com
;; global options: +cmd
;; Got answer:
@adeleinr
adeleinr / Git Cheatsheet
Last active September 5, 2015 07:04
Git Cheatsheet
-To have unversioned files add a .gitignore file in project root with name of files to ignore in it.
-------------------------------------------
Error ==> How to solve it
ERROR: adeleinr/SocialCard doesn't exist yet. Did you enter it correctly?
fatal: The remote end hung up unexpectedly
Edit the .git/config
@adeleinr
adeleinr / Simplest way to have a mail server for my domain
Created June 9, 2010 17:46
Best way to have a mail server for my domain
Best Solution - GoogleApps
Here's a summary of what I setup and how:
Signed-up at GoogleApps. The "Standard Edition" is just fine for me to get email service.
Next step is to validate your domain ownership by either posting a special file on a website running at the domain, or insert a special CNAME record in your dns entry
Once the domain is validated, the chat, docs, calendar and sites features will be active.
To enable Email, also need to configure the MX records for your domain
I have a domain registered at http://whois.com, but it was just pointing to a domain parking page, so I first had to add the "Managed DNS" service to my whois account and change my nameservers from the domain-parking addresses to the whois.com nameservers. Seemed to take about a day for this to propagate properly before I could proceed.
I added the special CNAME entry (as prompted by google) and told google apps to try and verify my domain ownership
Then simply had to add the MX records as prompted by google.
@adeleinr
adeleinr / SQL Notes
Created April 23, 2010 15:42
SQL Notes
--------------------
GROUP BY, DISTINCT
--------------------
"group by" lets you use aggregate functions, like avg, max, min, sum, and count. "distinct" just removes duplicates.
For example, if you have a bunch of purchase records, and you want to know how much was spent by each department, you might do something like:
select department, sum(amount) from purchases group by department
This will give you one row per department, containing the department name and the sum of all of the "amount" values in all rows for that department.
@adeleinr
adeleinr / VimCommands.txt
Created April 16, 2010 05:55 — forked from actaneon/VimCommands.txt
Vim Cheatsheet
http://vim.wikia.com/wiki/
GREP STUFF
==========
The :substitute command searches for a text pattern, and replaces it with a text string. There are many options, but these are what you probably want:
:%s/foo/bar/g
Find each occurrence of 'foo', and replace it with 'bar'.
:%s/foo/bar/gc
@adeleinr
adeleinr / Chrome Cheatcheet
Created April 16, 2010 05:52
Chrome Cheatsheet
Shift+Esc Brings Up Tab manager
Ctrl + Shift + T Undo closed tab
Ctrl + 1,2,3,..etc Brings up the first tab, 2nd, 3rd tab..etc
Ctrl + l Goes to the address bar
Ctrl + w Closes the current tab
@adeleinr
adeleinr / Linux Commands Cheatsheet
Created April 16, 2010 05:49
Linux Commands Cheatsheet
#Big grep
find Members/ -type f -print0 | xargs -0 grep "examplestring"
#grep line plus its context (1 line before 3 lines after)
grep -A 3 -B 1 “patter” filename
#10 biggest files in a directory
du -a /var | sort -n -r | head -n 10
#Get a column from a file