Skip to content

Instantly share code, notes, and snippets.

@cyeong
cyeong / gist:5383590
Created April 14, 2013 17:52
admin change
http://djangosnippets.org/snippets/255/
http://toastdriven.com/blog/2008/nov/21/customizing-admin-part-2/
https://docs.djangoproject.com/en/1.1/ref/contrib/admin/#adding-views-to-admin-sites
https://docs.djangoproject.com/en/1.1/ref/contrib/admin/actions/
http://stackoverflow.com/questions/14484369/how-to-add-top-save-button-on-django-admin-change-list
from __future__ import with_statement # we'll use this later, has to be here
from argparse import ArgumentParser
import requests
from BeautifulSoup import BeautifulStoneSoup as Soup
def parse_sitemap(url):
resp = requests.get(url)
# we didn't get a valid response, bail
{% extends "base.html" %}
{% block title %}Test django-paypal cart{% endblock %}
{% block content %}
<h1>Testing django-paypal cart</h1>
{{ form.render }}
{% endblock %}
@cyeong
cyeong / services.js
Created July 30, 2013 08:43
angular services, factory, provider
http://jsbin.com/ohamub/1/edit
var app = angular.module( 'app', [] );
var MyFunc = function() {
this.name = "default name";
this.$get = function() {
this.name = "new name"
@cyeong
cyeong / gist:6933030
Created October 11, 2013 11:08
yay dawg
/*@ /\ /\
* @ / \/ \ ----- | | ---- |---\ | | /--\ --- | | ---- /--\ /--\
* @ / -- | | | | | / | | | | |\ | | | |
* \---\ / \ | |---| ---- |--/ | | \ | | \ | ---- \ \
* | \------------------------/ /-\ \ | | | | | \ | | -\ | | \| | -\ -\
* | \-/ \ | | | ---- |---/ \--/ \--/ --- | \ ---- \--/ \--/
* \ ------O
* \ / --- | | ---- /--\ |--\ /--\ /--\
* | | | | / | |\ | | | | | | |
@cyeong
cyeong / gist:6933069
Created October 11, 2013 11:12
ROFL COPTERRRR
' ROFL:ROFL:LOL:ROFL:ROFL
' ______/|\____
' L / [] \
' LOL===_ ROFL \_
' L \_______________]
' I I
' /---------------/
@cyeong
cyeong / gist:6933083
Created October 11, 2013 11:14
HERE BE DRAGONS
// .==. .==.
// //`^\\ //^`\\
// // ^ ^\(\__/)/^ ^^\\
// //^ ^^ ^/6 6\ ^^ ^ \\
// //^ ^^ ^/( .. )\^ ^ ^ \\
// // ^^ ^/\| v""v |/\^ ^ ^\\
// // ^^/\/ / `~~` \ \/\^ ^\\
// -----------------------------
/// HERE BE DRAGONS
#! /bin/bash
# Script to automate creating new OpenVPN clients
# The client cert and key, along with the CA cert is
# zipped up and placed somewhere to download securely
#
# H Cooper - 05/02/11
#
# Usage: new-openvpn-client.sh <common-name>
# Set where we're working from
#!/bin/bash
# <http://blog.philippklaus.de/2010/09/openvpn/>
set -x
#SERVERNAME=$(hostname)
SERVERNAME=$(ifconfig | grep -A 5 eth0 | grep -w 'inet addr' | tr '\t' ' ' | cut -d ':' -f 2 | cut -d ' ' -f 1)
read -e -p "Please enter the server you want your clients to connect to [default: $SERVERNAME]: " input
SERVERNAME="${input:-$SERVERNAME}"
#!/usr/bin/env python
import os, sys
sys.path.append(os.getcwd())
import logging
import rq
MAX_FAILURES = 3