foreverasdasdasd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This is modifed from https://gist.github.com/caiguanhao/4528926 | |
# This is an improved script of pngfix.sh (https://gist.github.com/404909) | |
# which can also crush/shrink/optimize/losslessly compress JPEGs and GIFs. | |
# It is recommended you backup your image files before executing this script. | |
# Operation will be skipped if output file is bigger in size. | |
# | |
# use chmod +x crushimg.sh to make it executable and then ./crushimg.sh to run, or | |
# bash ./crushimg.sh to run it directly | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": 6, | |
"name": "banana" | |
}, | |
{ | |
"id": 5, | |
"name": "burrito" | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "222dcd03aed943a8676dc80e2427a40d", | |
"title": "The Headquarters", | |
"lat": 37.387617, | |
"long": -122.036132 | |
}, | |
{ | |
"id": "a102c4a959dfe7efdd3a4e112bee0407", | |
"title": "A Sweet Beach", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DisconnectCacheCloseSignal(object): | |
""" Add me to your settings.MIDDLEWARE_CLASSES """ | |
def process_response(self, request, response): | |
from django.core.cache import caches, close_caches | |
signals.request_finished.disconnect(caches['default'].close) | |
signals.request_finished.disconnect(close_caches) | |
return response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var domain = require('domain'); | |
var userMethod = 'handler'; | |
var userCodeWrapper = function(userCode) { | |
return '\ | |
"use strict";\n\ | |
' + userCode + '\n\ | |
try {\n\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import importlib | |
from multiprocessing import Pool | |
from django.test.simple import DjangoTestSuiteRunner | |
from django.conf import settings | |
__doc__ = """ | |
In settings.py do this: | |
JUXD_FILENAME = '/Code/project/junit.xml' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var vm = require('vm'), | |
Contextify = require('contextify'), | |
code = 'var square = n * n;', | |
fn = new Function('n', code), | |
script = vm.createScript(code); | |
n = 5; | |
benchmark = function(title, funk) { | |
var end, i, start, spins = 10000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/perl | |
# Written by Dormando. | |
# PUBLIC DOMAIN. | |
# No guarantees it won't eat your cat. | |
use warnings; | |
use strict; | |
use IO::Socket::INET; | |
use Time::HiRes qw/time sleep/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
from django.core.handlers.base import BaseHandler | |
from django.core import urlresolvers | |
SILENT_EARLY_RETURN_FAIL = getattr(settings, 'SILENT_EARLY_RETURN_FAIL', True) | |
def return_early_decorator(view): | |
""" | |
In a view, return early, like so: |