Skip to content

Instantly share code, notes, and snippets.

In [84]: a
Out[84]:
{'b1': {'c1': {'d1': 'X1', 'd2': 'X2'}, 'c2': {'d3': 'X3', 'd4': 'X4'}},
'b2': {'c3': {'d2': 'X6', 'd5': 'X1'}, 'c4': {'d7': 'X7', 'd8': 'X8'}}}
In [85]: f(a, 'b1/c2/d4')
Out[85]: 'X4'
In [86]: f(a, 'b2/c4')
Out[86]: {'d7': 'X7', 'd8': 'X8'}
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://ego:8080/scrumworks/jnlp/" href="scrumworks.jnlp">
<information>
<title>ScrumWorks Basic Client</title>
<vendor>ScrumWorks, LLC.</vendor>
<homepage href="/scrumworks" />
<description>ScrumWorks Basic - Unleash Team Self-Organization</description>
<description kind="short">ScrumWorks Basic Application</description>
<icon href="SWP_logoD_64.gif" />
<icon kind="splash" href="sw_web_logo.jpg" />
while (<>) {
s/(.*)/\[\U$1\]/;
print "$ARGV: $_";
}
k@kallen ~/tmp/prl % perl uni.pm
STRING: H€lłØ Wø®Łð
STRING LENGTH: 11
CHARACTERS: [H|€|l|ł|Ø| |W|ø|®|Ł|ð]
CHARACTERS LENGTH: 11
CHARACTERS MATCH AGAINST /Łð$/: <H€lłØ Wø®><Łð><>
BYTES: [H|â||¬|l|Å||Ã|| |W|Ã|¸|Â|®|Å||Ã|°]
BYTES LENGHT: 19
BYTES MATCH AGAINST /Łð$/: <H€lłØ Wø®><Łð><>
import time
def caca(n):
for i in xrange(n):
time.sleep(.2)
yield i
print "con generadores"
for i in caca(10):
print i
#include <stdio.h>
#include <string.h>
/*
* Escribe en ``pos`` la posicion del proximo caracter 'x' en ``s`` a
* donde ``pos`` >=``start``.
* Devuelve 0 si se puede encontrar 'x', de lo contrario, devuelve -1
*/
size_t find_all_x(char *s, size_t start, size_t *pos)
{
k@kallen ~ % ./qq
4 x 5 + 3 x 2
^
4 x 5 + 3 x 2
^
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <locale.h>
#include <wctype.h>
#include <langinfo.h>
int main(int argc, char **argv)
{
if (!setlocale(LC_ALL, "")) {
import datetime
import locale
def utc_datetime_from_twitter_string_timestamp(s):
"""Parses as datetime.datetime in UTC a string formated Twitter timestamp"""
# we must parse the date in an english locale (due to %a and %b)
prev_loc = locale.getlocale()
try:
locale.setlocale(locale.LC_ALL, 'C')
return datetime.datetime.strptime(s, u'%a %b %d %H:%M:%S +0000 %Y')
k@hirako ~ % cat hola.py
def f():
print u"bla bla"
print u"soy un virus malo!"
k@hirako ~ % python
Python 2.6.2c1 (release26-maint, Apr 14 2009, 08:02:02)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from hola import f
soy un virus malo!