This file contains hidden or 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 | |
def get_currency_number(value): | |
""" | |
>>> d = u'1Servi\xe7o' | |
>>> get_number_between_strings(d) | |
u'1' | |
>>> e = '78.1234,11Servi\xe7o' | |
>>> get_number_between_strings(e) | |
u'78.1234,11' |
This file contains hidden or 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
Show hidden characters
{ | |
"disable_default_element_completions": true | |
} |
This file contains hidden or 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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure(2) do |config| | |
# proxy config |
This file contains hidden or 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.core.management import BaseCommand | |
from django.core.management import call_command | |
from django.db import connection | |
import os | |
import shutil | |
import re | |
import tempfile | |
__doc__ = """ |
This file contains hidden or 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
n = 3 # Size of inner region | |
n2, n3, n4 = n**2, n**3, n**4 | |
def show(flatline): | |
'Display grid from a string (values in row major order with blanks for unknowns)' | |
fmt = '|'.join(['%s' * n] * n) | |
sep = '+'.join(['-' * n] * n) | |
for i in range(n): | |
for j in range(n): |
This file contains hidden or 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 itertools import permutations | |
n = 8 | |
cols = range(n) | |
for vec in permutations(cols): | |
if (n == len(set(vec[i] + i for i in cols)) | |
== len(set(vec[i] - i for i in cols))): | |
print(vec) |
This file contains hidden or 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
{ | |
"auto_complete": true, | |
"auto_complete_triggers": | |
[ | |
{ | |
"characters": "<", | |
"selector": "text.html" | |
} | |
], | |
"auto_indent": true, |
This file contains hidden or 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
[ | |
{ "keys": ["alt+shift+d"], "command": "find_under_expand" }, | |
{ "keys": ["alt+shift+a"], "command": "find_all_under" }, | |
{ "keys": ["ctrl+g"], "command": "goto_definition" }, | |
{ "keys": ["ctrl+d"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} }, | |
{ "keys": ["super+delete"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard EOL.sublime-macro"} }, | |
{ "keys": ["shift+super+w"], "command": "close_all"}, | |
{ "keys": ["ctrl+shift+r"], "command": "goto_symbol_in_project" }, | |
{ "keys": ["ctrl+alt+'"], "command": "auto_docstring" }, | |
{ "keys": ["ctrl+alt+shift+'"], "command": "auto_docstring_all" } |
This file contains hidden or 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
<code_scheme name="Default (1)"> | |
<option name="RIGHT_MARGIN" value="80" /> | |
<Python> | |
<option name="NEW_LINE_AFTER_COLON" value="true" /> | |
<option name="DICT_NEW_LINE_AFTER_LEFT_BRACE" value="true" /> | |
<option name="DICT_NEW_LINE_BEFORE_RIGHT_BRACE" value="true" /> | |
<option name="FROM_IMPORT_NEW_LINE_AFTER_LEFT_PARENTHESIS" value="true" /> | |
<option name="FROM_IMPORT_NEW_LINE_BEFORE_RIGHT_PARENTHESIS" value="true" /> | |
<option name="FROM_IMPORT_PARENTHESES_FORCE_IF_MULTILINE" value="true" /> | |
<option name="FROM_IMPORT_TRAILING_COMMA_IF_MULTILINE" value="true" /> |
This file contains hidden or 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
""" | |
Problem Statement | |
================= | |
Given different dimensions and unlimited supply of boxes for each dimension, stack boxes on top of each other such that | |
it has maximum height but with caveat that length and width of box on top should be strictly less than length and width | |
of box under it. You can rotate boxes as you like. | |
1) Create all rotations of boxes such that length is always greater or equal to width | |
2) Sort boxes by base area in non increasing order (length * width). This is because box | |
with more area will never ever go on top of box with less area. | |
3) Take T[] and result[] array of same size as total boxes after all rotations are done |