Skip to content

Instantly share code, notes, and snippets.

James CrazyPython

Block or report user

Report or block CrazyPython

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@CrazyPython
CrazyPython / grid.py
Created Dec 7, 2012
Useful libary of snippets(help improve)
View grid.py
"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 Dec 7, 2012 — forked from worenga/index.html
A CodePen by Benedikt Wolters.
View index.html
<!DOCTYPE html>
<html>
<h1>Conway's Game of Life</h1>
<canvas id="c"></canvas>
</html>
View Middleware.py
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
View Output
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 Aug 20, 2019
Simple heap wrapper library.
View heaps.py
import heapq
class Heap(object):
_heap = []
def __init__(self, l=()):
_heap = list(l)
heapq.heapify(_heap)
View logs
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 Jun 29, 2016
pprof final script code for you googlers :) - executable will be stored in `./.executables/profiler/`; modify for yourself.
View INSTALL.md
  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 Jun 29, 2016 — forked from DavideCanton/unionfind.py
Union find in Python
View unionfind.py
__author__ = 'davide'
import collections
class Element:
def __init__(self, parent, rank=0, size=1):
self.parent = parent
self.rank = rank
self.size = size
View main.cpp
#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 Jun 30, 2016
performance testing facility
View comparer.cpp
/*
* 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>
You can’t perform that action at this time.