Skip to content

Instantly share code, notes, and snippets.

@devsnd
devsnd / cprofile cherrypy
Created November 28, 2012 19:09
cprofile cherrypy updating one folder with a few subfolders
496853 function calls (487202 primitive calls) in 153.636 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.016 0.016 0.081 0.081 <string>:1(<module>)
470 0.009 0.000 0.018 0.000 <string>:12(__new__)
1 0.000 0.000 0.000 0.000 <string>:5(ArgInfo)
1 0.000 0.000 0.000 0.000 <string>:5(ArgSpec)
1 0.000 0.000 0.000 0.000 <string>:5(Arguments)
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division
import os
import sys
# based on https://gist.github.com/magopian/7543724
#
# refactored for manual control over permissions created.
projectname = input("Enter project name (for settings import): ")
@devsnd
devsnd / dnd_ordered_admin.py
Last active October 4, 2023 15:27
Quick hack to implement drag and drop for ordered model django admin
class DragndropOrderedModelAdmin(OrderedModelAdmin):
def move_above_view(self, request, object_id, other_object_id):
obj = get_object_or_404(self.model, pk=unquote(object_id))
other_obj = get_object_or_404(self.model, pk=unquote(other_object_id))
obj.above(other_obj)
# go back 3 levels (to get from /pk/move-above/other-pk back to the changelist)
return HttpResponseRedirect('../../../')
def get_urls(self):
def wrap(view):
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need
# fine tuning.
buildOptions = {
'packages': [],
'excludes': [
# remove unneeded parts of the standard lib
'unicodedata',
'pydoc',
echo "performance" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "performance" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo "performance" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo "performance" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
echo "performance" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
echo "performance" > /sys/devices/system/cpu/cpu5/cpufreq/scaling_governor
echo "performance" > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor
echo "performance" > /sys/devices/system/cpu/cpu7/cpufreq/scaling_governor
echo "performance" > /sys/devices/system/cpu/cpu8/cpufreq/scaling_governor
echo "performance" > /sys/devices/system/cpu/cpu9/cpufreq/scaling_governor