Skip to content

Instantly share code, notes, and snippets.

@sevas
sevas / gist:1021386
Created June 12, 2011 09:52
source python switchers
export OLD_PATH=$PATH
. $HOME/.python_switchers.sh
@sevas
sevas / gist:1021391
Created June 12, 2011 09:56
fancy prompt
select_macpython32()
{
echo "Setting environment for MacPython 3.2"
PATH="/Library/Frameworks/Python.framework/Versions/3.2/bin/:${OLD_PATH}"
export PATH
export PS1="(MacPython 3.2) \h:\W \u\$ "
}
def hex_to_rgb(hex_string_color):
"""
Convert a color encoded in an hex string into
an rgb tuple.
Example:
>> hex_to_rgb("5b6eff")
(91, 110, 255)
"""
@sevas
sevas / gist:1605251
Created January 13, 2012 09:17
set french locale on windows with python
# locale string from: http://msdn.microsoft.com/en-us/library/cdax410z(v=VS.80).aspx
if sys.platform in [ 'win32']:
locale.setlocale(locale.LC_ALL, 'fra')
@sevas
sevas / vax_iter.txt
Created February 20, 2012 11:44
Vissual Assist Container Iterator Macro
for ($ContainerType$::iterator $Iter=it$ = $Container$.begin();
$Iter$!=$Container$.end();
++$Iter$)
{
$end$
}
@sevas
sevas / rudolf.py
Created January 27, 2013 20:39
patched rudolf.py (color output for nose) to handle both py2.6 & py2.7's unittest interface.
"""Color output plugin for the nose testing framework.
Use ``nosetests --with-color`` (no "u"!) to turn it on.
http://en.wikipedia.org/wiki/Rudolph_the_Red-Nosed_Reindeer
"Rudolph the Red-Nosed Reindeer" is a popular Christmas story about Santa
Claus' ninth and lead reindeer who possesses an unusually red colored nose that
gives off its own light that is powerful enough to illuminate the team's path
through inclement weather.
{
"color_scheme": "Packages/Color Scheme - Default/Solarized (Dark).tmTheme",
"font_face": "Source Code Pro",
"font_size": 11.0,
"highlight_modified_tabs": true,
"theme": "Soda Dark.sublime-theme",
"trim_trailing_white_space_on_save": true,
"word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?",
"tab_size": 4,
"scroll_past_end": true,
@sevas
sevas / good_copytree.py
Created December 4, 2013 10:44
a non-retarded shutil.copytree (from http://stackoverflow.com/a/13814557/40056)
def copytree(src, dst, symlinks=False, ignore=None):
if not os.path.exists(dst):
os.makedirs(dst)
for item in os.listdir(src):
s = os.path.join(src, item)
d = os.path.join(dst, item)
if os.path.isdir(s):
copytree(s, d, symlinks, ignore)
else:
if not os.path.exists(d) or os.stat(src).st_mtime - os.stat(dst).st_mtime > 1:
@sevas
sevas / setup.cfg
Last active December 30, 2015 13:59
configuration file for nose tests
# a test file:///Users/sevas/PycharmProjects/gulbis/doc/build/html/test_attributes.html file:///Users/sevas/PycharmProjects/gulbis/doc/build/html/test_attributes.html file:///Users/sevas/PycharmProjects/gulbis/doc/build/html/test_attributes.html
[nosetests]
verbosity=3
with-doctest=1
doctest-tests=1
@sevas
sevas / cl.exe
Last active September 11, 2025 09:01
C/C++ COMPILER OPTIONS
-OPTIMIZATION-
/O1 minimize space /O2 maximize speed
/Ob<n> inline expansion (default n=0) /Od disable optimizations (default)
/Og enable global optimization /Oi[-] enable intrinsic functions
/Os favor code space /Ot favor code speed
/Ox maximum optimizations /Oy[-] enable frame pointer omission