Just an extension of my memory - a way to remember all these little tricks I end up forgetting after a while.. Seen a few people use a blog for this.. seems useful
Friday, November 29, 2013
Russel Brand - Talk compilation on spirituality
http://www.break.com/video/russell-brand-will-blow-your-mind-2544304
Sunday, October 13, 2013
Reading a single line of numbers from file to a list of floats
Let's say you have a text file that contains a row
and you wish to read this line and then save the three different numbers into three variables a,b and c.
Use the built in
... 23
23 34 155
and you wish to read this line and then save the three different numbers into three variables a,b and c.
Use the built in
map
and split
functions along with your file read>>> a,b,c = map(int, open('some_file.txt').read().split())
>>> print a
... 23
Convert seconds to minutes in Python
Let's say you have 255 seconds and you wish to have it as minutes and seconds,
mins, secs = divmod(255, 60)
Using
divmod()
will give you the minutes and seconds.The same can be done for a minutes-to-hours conversion
Wednesday, October 9, 2013
Why the Y generation is so unhappy
Article from the Huffintonpost - original link here
I did not write this
-------------------------------------------------------------------------------------------
With a smoother, more positive life experience than that of their own parents, Lucy's parents raised Lucy with a sense of optimism and unbounded possibility. And they weren't alone. Baby Boomers all around the country and world told their Gen Y kids that they could be whatever they wanted to be, instilling the special protagonist identity deep within their psyches.
To be clear, GYPSYs want economic prosperity just like their parents did -- they just also want to be fulfilled by their career in a way their parents didn't think about as much.
This would probably be a good time to bring in our second fact about GYPSYs:
So why is this delusional? Because this is what all GYPSYs think, which defies the definition of special:
So that's why Lucy is unhappy, or at the least, feeling a bit frustrated and inadequate. In fact, she's probably started off her career perfectly well, but to her, it feels very disappointing.
I did not write this
-------------------------------------------------------------------------------------------
Say hi to Lucy.
Lucy is part of Generation Y, the generation born between the late 1970s and the mid 1990s. She's also part of a yuppie culture that makes up a large portion of Gen Y.
I have a term for yuppies in the Gen Y age group -- I call them Gen Y Protagonists & Special Yuppies, or GYPSYs. A GYPSY is a unique brand of yuppie, one who thinks they are the main character of a very special story.
So Lucy's enjoying her GYPSY life, and she's very pleased to be Lucy. Only issue is this one thing:
Lucy's kind of unhappy.
To get to the bottom of why, we need to define what makes someone happy or unhappy in the first place. It comes down to a simple formula:
It's pretty straightforward -- when the reality of someone's life is better than they had expected, they're happy. When reality turns out to be worse than the expectations, they're unhappy.
To provide some context, let's start by bringing Lucy's parents into the discussion:
Lucy's parents were born in the '50s -- they're Baby Boomers. They were raised by Lucy's grandparents, members of the G.I. Generation, or "the Greatest Generation," who grew up during the Great Depression and fought in World War II, and were most definitely not GYPSYs.
Lucy's Depression Era grandparents were obsessed with economic security and raised her parents to build practical, secure careers. They wanted her parents' careers to have greener grass than their own, and Lucy's parents were brought up to envision a prosperous and stable career for themselves. Something like this:
They were taught that there was nothing stopping them from getting to that lush, green lawn of a career, but that they'd need to put in years of hard work to make it happen.
After graduating from being insufferable hippies, Lucy's parents embarked on their careers. As the '70s, '80s, and '90s rolled along, the world entered a time of unprecedented economic prosperity. Lucy's parents did even better than they expected to. This left them feeling gratified and optimistic.
With a smoother, more positive life experience than that of their own parents, Lucy's parents raised Lucy with a sense of optimism and unbounded possibility. And they weren't alone. Baby Boomers all around the country and world told their Gen Y kids that they could be whatever they wanted to be, instilling the special protagonist identity deep within their psyches.
This left GYPSYs feeling tremendously hopeful about their careers, to the point where their parents' goals of a green lawn of secure prosperity didn't really do it for them. A GYPSY-worthy lawn has flowers.
This leads to our first fact about GYPSYs:
GYPSYs Are Wildly Ambitious
The GYPSY needs a lot more from a career than a nice green lawn of prosperity and security. The fact is, a green lawn isn't quite exceptional or unique enough for a GYPSY. Where the Baby Boomers wanted to live The American Dream, GYPSYs want to live Their Own Personal Dream.
Cal Newport points out that "follow your passion" is a catchphrase that has only gotten going in the last 20 years, according to Google's Ngram viewer, a tool that shows how prominently a given phrase appears in English print over any period of time. The same Ngram viewer shows that the phrase "a secure career" has gone out of style, just as the phrase "a fulfilling career" has gotten hot.
To be clear, GYPSYs want economic prosperity just like their parents did -- they just also want to be fulfilled by their career in a way their parents didn't think about as much.
But something else is happening too. While the career goals of Gen Y as a whole have become much more particular and ambitious, Lucy has been given a second message throughout her childhood as well:
This would probably be a good time to bring in our second fact about GYPSYs:
GYPSYs Are Delusional
"Sure," Lucy has been taught, "everyone will go and get themselves some fulfilling career, but I am unusually wonderful and as such, my career and life path will stand out amongst the crowd." So on top of the generation as a whole having the bold goal of a flowery career lawn, each individual GYPSY thinks that he or she is destined for something even better --
A shiny unicorn on top of the flowery lawn.
So why is this delusional? Because this is what all GYPSYs think, which defies the definition of special:
spe-cial | 'speSHel |
adjective
better, greater, or otherwise different from what is usual.
According to this definition, most people are not special -- otherwise "special" wouldn't mean anything.
Even right now, the GYPSYs reading this are thinking, "Good point... but I actually am one of the few special ones" -- and this is the problem.
A second GYPSY delusion comes into play once the GYPSY enters the job market. While Lucy's parents' expectation was that many years of hard work would eventually lead to a great career, Lucy considers a great career an obvious given for someone as exceptional as she, and for her it's just a matter of time and choosing which way to go. Her pre-workforce expectations look something like this:
Unfortunately, the funny thing about the world is that it turns out to not be that easy of a place, and the weird thing about careers is that they're actually quite hard. Great careers take years of blood, sweat and tears to build -- even the ones with no flowers or unicorns on them -- and even the most successful people are rarely doing anything that great in their early or mid-20s.
But GYPSYs aren't about to just accept that.
Paul Harvey, a University of New Hampshire professor and GYPSY expert, has researched this, finding that Gen Y has "unrealistic expectations and a strong resistance toward accepting negative feedback," and "an inflated view of oneself." He says that "a great source of frustration for people with a strong sense of entitlement is unmet expectations. They often feel entitled to a level of respect and rewards that aren't in line with their actual ability and effort levels, and so they might not get the level of respect and rewards they are expecting."
For those hiring members of Gen Y, Harvey suggests asking the interview question, "Do you feel you are generally superior to your coworkers/classmates/etc., and if so, why?" He says that "if the candidate answers yes to the first part but struggles with the 'why,' there may be an entitlement issue. This is because entitlement perceptions are often based on an unfounded sense of superiority and deservingness. They've been led to believe, perhaps through overzealous self-esteem building exercises in their youth, that they are somehow special but often lack any real justification for this belief."
And since the real world has the nerve to consider merit a factor, a few years out of college Lucy finds herself here:
Lucy's extreme ambition, coupled with the arrogance that comes along with being a bit deluded about one's own self-worth, has left her with huge expectations for even the early years out of college. And her reality pales in comparison to those expectations, leaving her "reality - expectations" happy score coming out at a negative.
And it gets even worse. On top of all this, GYPSYs have an extra problem that applies to their whole generation:
GYPSYs Are Taunted
Sure, some people from Lucy's parents' high school or college classes ended up more successful than her parents did. And while they may have heard about some of it from time to time through the grapevine, for the most part they didn't really know what was going on in too many other peoples' careers.
Lucy, on the other hand, finds herself constantly taunted by a modern phenomenon:Facebook Image Crafting.
Social media creates a world for Lucy where A) what everyone else is doing is very out in the open, B) most people present an inflated version of their own existence, and C) the people who chime in the most about their careers are usually those whose careers (or relationships) are going the best, while struggling people tend not to broadcast their situation. This leaves Lucy feeling, incorrectly, like everyone else is doing really well, only adding to her misery:
So that's why Lucy is unhappy, or at the least, feeling a bit frustrated and inadequate. In fact, she's probably started off her career perfectly well, but to her, it feels very disappointing.
Here's my advice for Lucy:
1) Stay wildly ambitious. The current world is bubbling with opportunity for an ambitious person to find flowery, fulfilling success. The specific direction may be unclear, but it'll work itself out -- just dive in somewhere.
2) Stop thinking that you're special. The fact is, right now, you're not special. You're another completely inexperienced young person who doesn't have all that much to offer yet. You can become special by working really hard for a long time.
3) Ignore everyone else. Other people's grass seeming greener is no new concept, but in today's image crafting world, other people's grass looks like a glorious meadow. The truth is that everyone else is just as indecisive, self-doubting, and frustrated as you are, and if you just do your thing, you'll never have any reason to envy others.
Video from the Huffinton Post:
Adding Coverage reports to a GitHub repository
Great service from Coverals
They include instruction sets for different languages like Python ect.
Free for open-source projects
They include instruction sets for different languages like Python ect.
Free for open-source projects
Wednesday, August 28, 2013
Responsive Design with CSS
Fantastic tutorial here on Responsive Design using CSS.
From the post:
From the post:
Responsive web design is the practice of building a website suitable to work on every device and every screen size, no matter how large or small, mobile or desktop. Responsive web design is focused around providing an intuitive and gratifying experience for everyone. Desktop computer and cell phone users alike all benefit from responsive websites.
Wednesday, May 22, 2013
Adding a colorbar to a plot
# Create the maps in a subset of the figure: we leave space for the colorbar
v = viz.plot_map(data, affine, axes=[0., 0., 0.9, 1.])
# Create a dedicated Axis for the colorbar
cax = v.axes['z'].ax.get_figure().
add_axes([0.9, 0.1, 0.03, 0.8])
# Add the colorbar relatively to the "seconde layer" of the last map
colorbar(v.axes['z'].ax.
images[1], cax=cax)
To correctly position the colorbar you can first create an axis/figure that you pass as plot_map arguments.
fig = pl.figure(figsize=(6, 3), facecolor='w', edgecolor='w')
ax = pl.axes([.02, .0, .83, .95], axisbg='w')
slicer = plot_map(tag_map, affine, title=title, cmap=pl.cm.hot,
vmin=-vmax, vmax=vmax, figure=fig, axes=ax)
cax = slicer.axes['z'].ax.get_figure().add_axes([.87, .1, .03, .8])
pl.colorbar(slicer.axes['x'].ax.images[1], cax=cax)
Saturday, April 27, 2013
Awesome List of Free Science Books
Great list of free science books.
See here
----------------------------------------------------------------------------
See here
----------------------------------------------------------------------------
A
- A Brief Introduction to Particle Physics
- A Gentle Introduction to the Art of Mathematics
- A Introduction to Proofs and the Mathematical Vernacular
- A Popular History of Astronomy During the Nineteenth Century, Fourth Edition
- A Tour of Triangle Geometry
- Acoustic Emission
- Adaptive Control
- Advanced Microwave Circuits and Systems
- Advanced Technologies
- Advances in Computer Science and IT
- Advances in Evolutionary Algorithms
- Advances in Geoscience and Remote Sensing
- Advances in Haptics
- Advances in Human Computer Interaction
- Aging by Design
- An Introduction to Many Worlds in Quantum Computation
- An Introduction to Particle Physics
- An Introduction to Relativistic Quantum Mechanics
- Analysis 1 (Tao T)
- Analysis 2 (Tao T)
- Analytic functions
- Astronomical Discovery
- Astronomy for Amateurs
- Astronomy for Amateurs
- Astronomy of To-day A Popular Introduction in Non-Technical Language
- Astronomy with an Opera-glass
B
- Basic Concepts of Mathematics
- Biochemistry
- Biochemistry
- Biochemistry I
- Bioinorganic Chemistry
- Bioinorganic Chemistry
- Board Notes for Particle Physics
C
- Celestial Navigation, Elementary Astronomy, Piloting
- Classical Geometry (Danny Calegari)
- Climate Models
- Computational Geometry
- Consistent Quantum Theory
- Cook-Book Of Mathematics
- Crude Oil Emulsions- Composition Stability and Characterization
- Curiosities of the Sky
D
- Decoherence: Basic Concepts and Their Interpretation
- Do we really understand quantum mechanics?
- Diophantine Analysis
- Dr. Donald Luttermoser’s Physics Notes
E
- Earthquake Research and Analysis
- Earthquake-Resistant Structures – Design, Assessment and Rehabilitation
- Elementary Particle Physics
- Elements of Astrophysics
- Embedded Systems – Theory and Design Methodology
- Encyclopaedia of Mathematics
- Encyclopedia of Astrophysics
- Engineering Mathematics 1
- Engineering Mathematics with Tables
- Essential Engineering Mathematics
- Exoplanet Observing for Amateurs
- Experimental Particle Physics
F
- Foundations of Nonstandard Analysis
- Frequently Asked Questions about Calendars
- Fundamental Concepts of Mathematics
- Fundamentals of Analysis (Chen W.W.L)
- Further Mathematical Methods
G
- Geometric Asymptotics
- Geometry and Group Theory
- Geometry and Topology
- Geometry Formulas and Facts
- Geometry study guide
- Geometry, Topology, Geometric Modeling
- Great Astronomers
H
- Handbook of Formulae and Physical Constants
- Handbook of Mathematics for Engineers
- High School Mathematics Extensions
- Higher Mathematics for Engineers and Physicists
- History of Astronomy
- Homeomorphisms in Analysis
I
- Intelligent Systems
- Intrinsic Geometry of Surfaces
- Introduction To Finite Mathematics
- Introduction to particle physics notes
- Introduction to PID Controllers
- Introduction to Quantum Mechanics with Applications to Chemistry
- Introduction to Quantum Noise, Measurement and Amplification
- Introduction to the Time Evolution of Open Quantum Systems
- Introductory Quantum Mechanics II
L
- Laws of Physics
- Learn Physics Today
- Lecture Notes in Discrete Mathematics
- Lecture Notes in Quantum Mechanics
- Lecture Notes Nuclear and Particle Physics
- Lecture notes Particle Physics
- Lectures on Astronomy, Astrophysics, and Cosmology
- Lectures on Entire Functions
- Lectures on Particle Physics
M
- Mag 7 Star Atlas Project
- Many Particle Physics II
- Math Alive
- Mathematical Analysis I(Zakon E)
- Mathematical Methods
- Mathematical Methods for Physical Sciences II
- Mathematical Methods of Engineering Analysis
- Mathematics for Computer Science
- Mathematics for Computer Science
- Mathematics for Computer Scientists
- Mathematics For Engineering Students
- Mathematics Formulary
- Motion Mountain
N
- Natural Disasters
- New Frontiers in Graph Theory
- Noise Control, Reduction and Cancellation Solutions in Engineering
- Nondestructive Testing Methods and New Applications
- Nonlinear Optics
- Notes on Coarse Geometry
- Notes on Elementary Particle Physics
- Notes on Quantum Mechanics
- Nuclear and Particle Physics
O
P
- Particle Physics Course Univ. Cape Town
- Particle Physics Lecture Notes
- Perspectives in Quantum Physics: Epistemological, Ontological and Pedagogical
- Photons, Schmotons
- Physics Tutorials
- Pioneers of Science
- Primer Of Celestial Navigation
- Principal Component Analysis
- Principal Component Analysis – Multidisciplinary Applications
- Publications of the Astronomical Society of the Pacific Volume 1
Q
- Quantum Dissipative Systems
- Quantum Fluctuations
- Quantum Information Theory
- Quantum Magnetism
- Quantum Mechanics
- Quantum Mechanics
- Quantum Mechanics: A graduate course
- Quantum mechanics: An intermediate level course
- Quantum Notes
- Quantum Physics Notes
- Quantum Theory of Many – particle Systems
- Quantum Transients
R
- Recreations in Astronomy
- Relativistic Quantum Dynamics
- Riemann surfaces, dynamics and geometry Course Notes
S
- Short History of Astronomy
- Sintering of Ceramics – New Emerging Techniques
- Star-Gazer’s Hand-Book
- Street-Fighting Mathematics
- Structures of Life
- System of Systems
T
- The Astronomy of the Bible
- The Astronomy of the Bible: An Elementary Commentary on the Astronomical References of Holy Scripture
- The basic paradoxes of statistical classical physics and quantum mechanics
- The Convenient Setting of Global Analysis
- The Eightfold Way The Beauty of Klein’s Quartic Curve(1999)
- The Geometry of the Sphere
- The Handbook of Essential Mathematics
- The Moon: A Full Description and Map of its Principal Physical Features
- The Origin of Mass in Particle Physics
- The Particle Detector Brief Book
- The Physics Hypertextbook
- The Physics of Quantum Mechanics
- The Small n Problem in High Energy Physics
- The Story of Eclipses
- The Story of the Heavens
- The world according to the Hubble Space Telescope
- The Zij as-Sanjari of Gregory Chioniades (June 27, 2009)
- Three Dimensional Geometry
U
Subscribe to:
Posts (Atom)