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
The following NEW packages will be installed: | |
ghc libbsd-dev{a} libffi-dev{a} libgmp-dev{a} | |
0 packages upgraded, 4 newly installed, 0 to remove and 0 not upgraded. | |
Need to get 26.2 MB of archives. After unpacking 295 MB will be used. | |
Do you want to continue? [Y/n/?] | |
Get: 1 http://debian.linuxmint.com/latest/ testing/main libbsd-dev amd64 0.6.0-1 [157 kB] | |
Err http://debian.linuxmint.com/latest/ testing/main libffi-dev amd64 3.0.13-4 | |
500 Internal Server Error | |
Get: 2 http://debian.linuxmint.com/latest/ testing/main libgmp-dev amd64 2:5.1.2+dfsg-3 [581 kB] | |
Get: 3 http://debian.linuxmint.com/latest/ testing/main ghc amd64 7.6.3-5 [25.3 MB] |
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
-e git+https://github.com/pashinin/fabric@p33#egg=Fabric | |
-e git+https://github.com/paramiko/paramiko/@python3#egg=paramiko |
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 exchange(self, price): | |
#default = Currency.objects.get(iso4217=DEFAULT_CURRENCY) | |
try: | |
rate = self.exchangerate_set.all()[0] | |
return Decimal(str(float(rate.denominator) * float(price))) | |
except IndexError: | |
return price |
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 exchange(self, price): | |
#default = Currency.objects.get(iso4217=DEFAULT_CURRENCY) | |
try: | |
rate = self.exchangerate_set.all()[0] | |
return Decimal(str(float(rate.denominator) * float(price))) | |
except IndexError: | |
return price |
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
Firefox dev console: | |
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://avosapi.delicious.com/api/v1/account/public/profile/spookylukey?_=1413809903947. This can be fixed by moving the resource to the same domain or enabling CORS. | |
Chrome dev console: | |
XMLHttpRequest cannot load https://avosapi.delicious.com/api/v1/account/public/profile/spookylukey?_=1413809942129. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://delicious.com' is therefore not allowed access. The response had HTTP status code 503. |
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
$ mkdir bugtest | |
$ cd bugtest | |
$ virtualenv --python=python2.7 env_p27 | |
Running virtualenv with interpreter /usr/bin/python2.7 | |
New python executable in env_p27/bin/python2.7 | |
Also creating executable in env_p27/bin/python | |
Please make sure you remove any previous custom paths from your /home/luke/.pydistutils.cfg file. | |
Installing setuptools, pip...done. | |
$ source env_p27/bin/activate |
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
#!/usr/bin/env python | |
# How to post code snippets (especially Python) into comment systems | |
# that don't preserve whitespace. | |
# Save this as a script called 'convert_leading_spaces_to_nonbreaking' | |
# in your PATH and do "chmod +x" on it. | |
# | |
# In Linux, you can then use it by installing xsel and doing: | |
# |
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
// See http://www.reddit.com/r/programming/comments/as759/hey_reddit_out_of_these_4_programmers_who_would/ | |
using System; | |
class MainClass { | |
static int Main(string[] argv) { | |
foreach (string s in new string[] {"hello", "λ", Char.ConvertFromUtf32(0x1D161)}) { | |
Console.WriteLine(s); | |
Console.WriteLine(Reverse(s)); | |
} |
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
# 100% code coverage, with an obvious type level bug that is not caught - Bar | |
# does not define method2 and do_it will fail for some values. | |
class Foo(object): | |
def method1(self, arg): | |
return arg + 1 | |
def method2(self, arg): | |
return arg + 2 |
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
#!/usr/bin/env python | |
# Quick and dirty script to convert ktimetracker.ics files | |
# into TimeCult files. | |
import os.path | |
import sys | |
import time | |
import uuid |
OlderNewer