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
<?php | |
$connection = odbc_connect("YOURCONNECTION", "", ""); | |
$result = odbc_tables($connection); | |
$tables = array(); | |
while (odbc_fetch_row($result)) | |
{ | |
if(odbc_result($result,"TABLE_TYPE")=="TABLE") | |
{ |
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
def mongo_to_dict(obj): | |
""" Turn a mongoengine object into a jsonible python object | |
""" | |
return_data = [] | |
if isinstance(obj, db.Document): | |
return_data.append(("id", str(obj.id))) | |
for field_name in obj._fields: |
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
#sortable1 li, #sortable2 li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; width: 120px; } |
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 PIL import Image | |
def autorotate(path): | |
""" This function autorotates a picture based upon its EXIF data | |
because smartphones use a little used EXIF option to set the | |
rotation of an image rather than save the data in that orientation | |
""" | |
image = Image.open(path) | |
try: |
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 pandas | |
import numpy | |
def resampled_data(query, date_col, target_col, period="M"): | |
""" Function that takes an sql query and returns the sum of a target column | |
by a period. Useful for getting monthly data | |
""" | |
df = pandas.read_sql(query, conn) | |
df.set_index(df[date_col], inplace=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
import std.stdio; | |
import Dgame.Window; | |
import Dgame.Graphic; | |
import Dgame.System.StopWatch; | |
import Dgame.System.Font; | |
import Dgame.System.Keyboard; | |
interface Entity { |
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 std.traits : isNumeric; | |
struct RingBuffer (T, uint buffer_length = 4) if (isNumeric!T) { | |
private T[buffer_length] buffer; | |
private T sum; | |
private byte lastIndex; | |
@safe @nogc nothrow pure { | |
this(const T initial_value) { | |
this.lastIndex = 0; |
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 std.traits: hasMember; | |
/* | |
Quadtree implementation that allows the collision resolver | |
to only scan a small subset of the possible colliding objects | |
See Also: | |
http://gamedevelopment.tutsplus.com/tutorials/quick-tip-use-quadtrees-to-detect-likely-collisions-in-2d-space--gamedev-374 | |
*/ | |
struct Quadtree(T, uint MAX_OBJECTS = 10, uint MAX_LEVELS = 5) if ( |
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
[Environment] | |
DFLAGS=-I%@P%/../../phobos -I%@P%/../../druntime/import -w -dip25 -m64 -g -debug -L%@P%/../../phobos/generated/osx/debug/64/libphobos2.a |
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
################ Unified Information ################ | |
Cores per CPU = 2 | |
Threads per CPU = 4 | |
------------------ TLB Information ------------------ | |
Instruction TLB: | |
- - - - - ITLB1: - - - - - - - - - - - - - - - - - - | |
Page size = 4 KB | |
Pages count = 64 | |
Pages count = 64 | |
Associativity: 8-way associative |
OlderNewer