Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

class NamedVector(object):
def __init__(self, array, names):
for i in xrange(len(names)):
self.__dict__[names[i]] = array[i] if i < len(array) else None
f = NamedVector([1, 4], ("hi", "ho", "ee"))
print f.hi, f.ho, f.ee
f = NamedVector([1, 4, 99], ("hi", "ho", "ee"))
@yuvipanda
yuvipanda / gist:e8464240f1b3ab228568
Created May 30, 2014 17:55
Sample HTML for app
<html dir="ltr" class="content-ltr ui-ltr"><head>
<base href="https://wikipedia.org"> <!-- Force links to resolve with https as protocol, rather than file:// -->
<script src="file:///android_asset/bundle.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes, minimum-scale=0.25, maximum-scale=1.6">
<link rel="stylesheet" type="text/css" href="file:///android_asset/styles.css"></head>
<body>
<div id="content" class="content"><h1 id="heading_0" class="section_heading" data-id="0"><i>Derfflinger</i>-class battlecruiser<a data-id="0" data-action="edit_section" class="edit_section_button"></a></h1><div id="#content_block_0">
<p>The <b><i>Derfflinger</i> class</b> was a <a href="/wiki/Ship_class" title="Ship class">class</a> of three <a href="/wiki/Battlecruiser" title="Battlecruiser">battlecruisers</a> (German: <span lang="de" xml:lang="de"><i>Schlachtkreuzer</i></span>) of the <a href="/wiki/Imperial_German_Navy" title="Imperial German Navy">Imperial Ger
@yuvipanda
yuvipanda / gist:bbe2a1317d15dc1d1094
Created May 30, 2014 18:03
HTML Structure of the app
<html dir="ltr" class="content-ltr ui-ltr">
<head>
<base href="https://wikipedia.org">
<!-- Force links to resolve with https as protocol, rather than file:// -->
<script src="file:///android_asset/bundle.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes, minimum-scale=0.25, maximum-scale=1.6">
<link rel="stylesheet" type="text/css" href="file:///android_asset/styles.css">
</head>
<body>
<div id="content" class="content">
from sqlalchemy import Column, Integer, ForeignKey, String, DateTime, desc
from sqlalchemy.orm import relationship, joinedload
from base import Base
from user import User # noqa
class Query(Base):
__tablename__ = 'query'
id = Column(Integer, primary_key=True)
# Configuration file for jupyterhub.
c = get_config()
#------------------------------------------------------------------------------
# JupyterHub configuration
#------------------------------------------------------------------------------
# An Application for starting a Multi-User Jupyter Notebook server.
# No caching at all
~/c/ores-stress $ python3.4 /tmp/test.py 'data/tools-static.wmflabs.org/lolrrit-wm/1/*.out'
inflights
mean 1.756802902571764
median 1
pstdev 2.4299546779621792
latency
mean 1724.702838648917
median 838.930203
pstdev 2159.033094872801
text = raw_input("Enter a text ")
textsplit = text.split()
count = len(textsplit)
print "The word count is = " + str(count)
a=600851475143
i=2
while i<a :
if a%i==0:
a1=a/i
else :
i+=1
continue
n=2
dsfsdf
past = 0
cur = 1
next = 1
sum = 0
while next < 4000000:
next = cur + past
past = cur
cur = next