Skip to content

Instantly share code, notes, and snippets.

View yogeshc's full-sized avatar

Yogesh yogeshc

View GitHub Profile
@yogeshc
yogeshc / gemfileTemplate.rb
Created November 28, 2012 06:32
Template for default Gemfile used for Heroku deployment in Rails Tutorial Book
gem('pg', :group=>'production')
gem('sqlite3', :group=>'development')
@yogeshc
yogeshc / gist:4589230
Created January 21, 2013 20:51
ipython error
$ ipython notebook --debug
[NotebookApp] Config changed:
[NotebookApp] {'Application': {'log_level': 10}}
[NotebookApp] Using existing profile dir: u'/home/yogesh/.config/ipython/profile_default'
[NotebookApp] Searching path [u'/home/yogesh/Downloads/Courses/python-talks/numba/ipython/ipython-master', u'/home/yogesh/.config/ipython/profile_default'] for config files
[NotebookApp] Attempting to load config file: ipython_config.py
[NotebookApp] Config file ipython_config.py not found
[NotebookApp] Attempting to load config file: ipython_notebook_config.py
[NotebookApp] Config file not found, skipping: ipython_notebook_config.py
[NotebookApp] Serving notebooks from /home/yogesh/Downloads/Courses/python-talks/numba/ipython/ipython-master
[NotebookApp] Kernel 325611a2-4752-4ef6-8100-256b209a7522 failed to respond to heartbeat
^[[B^CShutdown Notebook Server (y/[n])? y
[NotebookApp] Shutdown confirmed
[NotebookApp] Shutting down kernels
ERROR:root:Uncaught exception, closing connection.
Traceback (most recent call last):
File "/home/yogesh/.virtualenvs/epd/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 444, in _handle_events
self._handle_send()
File "/home/yogesh/.virtualenvs/epd/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 487, in _handle_send
status = self.socket.send_multipart(msg, **kwargs)
[NotebookApp] Using existing profile dir: u'/home/yogesh/.config/ipython/profile_default'
[NotebookApp] Serving notebooks from /home/yogesh/Downloads/Courses/python-talks
[NotebookApp] The IPython Notebook is running at: http://127.0.0.1:8888/
[NotebookApp] Use Control-C to stop this server and shut down all kernels.
Created new window in existing browser session.
[NotebookApp] Using MathJax from CDN: http://cdn.mathjax.org/mathjax/latest/MathJax.js
[NotebookApp] Kernel started: 84424379-6ce7-4ea0-b3ed-e3d5a2d4fb1e
[NotebookApp] Connecting to: tcp://127.0.0.1:52016
[NotebookApp] Connecting to: tcp://127.0.0.1:55996
[NotebookApp] Connecting to: tcp://127.0.0.1:53254
import requests
class Content(object):
def where(self, params={}):
return Query(self).where(params)
def all(self):
return Query(self).all()
class Query(object):

Notes for Python Science Apps talk

Presentation

ln -s /usr/include/freetype2/freetype /usr/local/include/freetype
ln -s /usr/include/ft2build.h /usr/local/include/ft2build.h
ln -s /usr/include/png.h /usr/local/include/png.h
ln -s /usr/include/pngconf.h /usr/local/include/pngconf.h
ln -s /usr/include/pngconf.h /usr/local/include/pngconf.h^C
ln -s /usr/include/pnglibconf.h /usr/local/include/pnglibconf.h
ln -s /usr/lib/libfreetype.so /usr/local/lib/libfreetype.so
ln -s /usr/lib/libfreetype.a /usr/local/lib/libfreetype.a
ln -s /usr/lib/libfreetype.la /usr/local/lib/libfreetype.la
@yogeshc
yogeshc / Sieve_of_Eratosthenes.py
Created July 8, 2013 16:55
This is the Sieve of Eratosthenes, to get the nth prime number (a.k.a Euler #7)
#The famous Sieve_of_Eratosthenes
def primes():
yield 2 ; yield 3 ; yield 5 ; yield 7 ;
ps = (p for p in primes()) # additional primes supply
p = ps.next() and ps.next() # discard 2, then get 3
q = p*p # 9 - square of next prime to be put
sieve = {} # into sieve dict
n = 9 # the candidate number
while True:
@yogeshc
yogeshc / gist:5961221
Created July 9, 2013 20:55
Node js grader to check for checking presence of specified HTML tags/attributes
#!/usr/bin/env node
/*
Automatically grade files for the presence of specified HTML tags/attributes.
Uses commander.js and cheerio. Teaches command line application development
and basic DOM parsing.
References:
+ cheerio
- https://github.com/MatthewMueller/cheerio
@yogeshc
yogeshc / SoundBoard
Created October 7, 2014 13:17
Simple example of a soundboard app created using swift for iOS
//
// DhwaniBoardViewController.swift
// DhwaniBoard
//
// Created by Yogesh on 05/10/2014.
// Copyright (c) 2014 appcodr. All rights reserved.
//
import Foundation
import UIKit