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
Collection of oneliner music formulas. Version 2011-10-18 | |
I've tried to collect all the formulas in the related threads etc. | |
(excluding those that clearly sound like random first experiments or total | |
crap; when several variants are available, i've chosen the shortest one) | |
If you think I've missed something that should be here, please let me know. | |
====== 1ST ITERATION ====== |
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 Image, ExifTags | |
try: | |
image=Image.open(os.path.join(path, fileName)) | |
for orientation in ExifTags.TAGS.keys(): | |
if ExifTags.TAGS[orientation]=='Orientation': break | |
exif=dict(image._getexif().items()) | |
if exif[orientation] == 3: | |
image=image.rotate(180, expand=True) |
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/env python | |
import re | |
from timeit import timeit | |
import unittest | |
UNIQ_RE = re.compile(r'(.)(?=.*?\1)') | |
TESTS = { | |
'test': 'e', | |
'plperl': 'e', |
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.shortcuts import render | |
class RestfulView(object): | |
allowed_methods = ["GET", "POST"] | |
def __call__(self, request, *args, **kwargs): | |
if request.method not in self.allowed_methods or not hasattr(self, request.method): | |
return self.method_not_allowed(request) | |
return getattr(self, request.method)(request, *args, **kwargs) |
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
# _ = empty | |
# X = solid ground | |
# S = sand | |
_________________ | |
_____SSSSSS______ | |
___SSSXXXXSSS____ | |
____SSSXXXXSSS___ | |
______SSSSSS_____ |
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 | |
last_non_blank_ln=$(grep -En ^. $1 |tail -n 1 |sed 's/:.*//') | |
head -n $((last_non_blank_ln + 1)) $1 > _xxx | |
mv _xxx $1 |
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
(box2d-html5) -> git commit | |
[master e170981] There are two sides to every issue: one side is right and the other is wrong, but the middle is always evil. | |
120 files changed, 125 insertions(+), 125 deletions(-) | |
rename contrib/{Enhancements/Controllers/b2BuoyancyController.js => enhancements/controllers/buoyancycontroller.js} (100%) | |
rename contrib/{Enhancements/Controllers/b2ConstantAccelController.js => enhancements/controllers/constantaccelcontroller.js} (100%) | |
rename contrib/{Enhancements/Controllers/b2ConstantForceController.js => enhancements/controllers/constantforcecontroller.js} (100%) | |
rename contrib/{Enhancements/Controllers/b2Controller.js => enhancements/controllers/controller.js} (100%) | |
rename contrib/{Enhancements/Controllers/b2GravityController.js => enhancements/controllers/gravitycontroller.js} (100%) | |
rename contrib/{Enhancements/Controllers/b2TensorDampingController.js => enhancements/controllers/tensordampingcontroller.js} (100%) | |
rewrite contrib/paths.json (99%) |
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 re | |
import sys | |
def replacer_pro(match): | |
print match.group(1) | |
parts = match.group(1).split('.') | |
init_code = '' | |
cur = '' | |
for part in parts: | |
if cur: |
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
/(?:GLAPI\b)(.*?)(?:GL)?APIENTRY(.*?)\((.*?)\)/ |
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 | |
sed -E 's/[[:<:]]SetXYZ?[[:>:]]/Set/g' "$@" |