Skip to content

Instantly share code, notes, and snippets.

@CrazyPython
CrazyPython / grid.py
Created December 7, 2012 23:09
Useful libary of snippets(help improve)
"version .1 supports __getitem__ and __setitem__ and fill and fillrect"
"version .2 supports __str__ and __dict__"
"""
version .3
full iteriator support
__len__ and __contains__
added documentation
__setitem__ and __setitem__supports slices with support for versions below 2.0(very unlikley)
"""
@CrazyPython
CrazyPython / index.html
Created December 7, 2012 23:21 — forked from worenga/index.html
A CodePen by Benedikt Wolters.
<!DOCTYPE html>
<html>
<h1>Conway's Game of Life</h1>
<canvas id="c"></canvas>
</html>
from django.http import HttpResponse
_current_shutdown_middleware = None
# Used in situations where it must shutdown before it gets initialized
_pre_shutdown = False
class ShutdownMiddleware(object):
shutting_down = False
Finished preparing.
Executing test 1
Executing test 2
Math module: maximmum 0.238082885742; minummum 0.166098117828; average 0.191208680471
Numpy module: maximmum 1.90435886383; minummum 1.6759428978; average 1.78847424189
@CrazyPython
CrazyPython / heaps.py
Last active August 20, 2019 13:25
Simple heap wrapper library.
import heapq
class Heap(object):
_heap = []
def __init__(self, l=()):
_heap = list(l)
heapq.heapify(_heap)
@CrazyPython
CrazyPython / logs
Last active June 29, 2016 19:11
...
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -disable-free -disable-llvm-verifier -main-file-name scratch.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 264.3.102 -v -dwarf-column-info -debug-info-kind=standalone -dwarf-version=2 -femit-coverage-notes -femit-coverage-data -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.3.0 -stdlib=libc++ -O2 -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /redacted/file/path -ferror-limit 19 -fmessage-length 199 -stack-protector 1 -fblocks -fobjc-ru
@CrazyPython
CrazyPython / INSTALL.md
Last active June 29, 2016 20:18
pprof final script code for you googlers :) - executable will be stored in `./.executables/profiler/`; modify for yourself.
  1. download file
  2. chmod 777 profile.sh
  3. put a symlink to it in /usr/bin, or just put it in there (optional)
@CrazyPython
CrazyPython / unionfind.py
Created June 29, 2016 23:30 — forked from DavideCanton/unionfind.py
Union find in Python
__author__ = 'davide'
import collections
class Element:
def __init__(self, parent, rank=0, size=1):
self.parent = parent
self.rank = rank
self.size = size
@CrazyPython
CrazyPython / main.cpp
Created June 30, 2016 21:15
bitset testing
#include <ctime>
#include <iostream>
#include <ctype.h>
#include <algorithm>
#include <vector>
#include <sstream>
using namespace std;
typedef bitset<24> bits;
bitset<24> inline method1(string str) {
@CrazyPython
CrazyPython / comparer.cpp
Created June 30, 2016 21:21
performance testing facility
/*
* Created by CrazyPython.
* Licensed under CC Attribution 4.0 International
* License text at https://creativecommons.org/licenses/by/4.0/
*/
#include <ctime>
#include <iostream>
#include <ctype.h>
#include <algorithm>
#include <vector>