Skip to content

Instantly share code, notes, and snippets.

View gotodeploy's full-sized avatar
💭
looking for a job

gotodeploy

💭
looking for a job
View GitHub Profile
@lewg
lewg / block_china_ufw.sh
Created January 18, 2013 15:53
UFW blocks for China, Korea, Malaysia, Phillipines, Singapore, Thailand and Vietnam netblocks
#!/bin/sh
# UFW blocks for China, Korea, Malaysia, Phillipines, Singapore, Thailand and Vietnam netblocks
# Based on http://www.wizcrafts.net/chinese-iptables-blocklist.html
# Cambodia (KH)
ufw deny from 114.134.184.0/21 to any port 22
# Chinese (CN) IP addresses follow:
ufw deny from 1.192.0.0/13 to any port 22
ufw deny from 1.202.0.0/15 to any port 22
@jsanchezpando
jsanchezpando / middleware.py
Created December 20, 2012 09:38
Simple Django super class to track user and save creator and modifier of a Model.
from myapp.utils import set_current_user
class CurrentUserMiddleware:
def process_request(self, request):
set_current_user(getattr(request, 'user', None))