Skip to content

Instantly share code, notes, and snippets.

View stangirala's full-sized avatar
🙃

Sarma stangirala

🙃
View GitHub Profile
#include <stdio.h>
int main() {
int i, j;
for (i = 1; i <= 100; i++) {
j = 0;
@stangirala
stangirala / gist:5259219
Created March 27, 2013 23:47
Bounded Sieve of Eratosthenes.
#include "iostream"
#include "vector"
#include "math.h"
using namespace::std;
inline void generate_sieve(vector<int> &sieve) {
long long int top = 1000000000;
@stangirala
stangirala / immutable_inheritence.py
Last active December 12, 2015 02:58
Example for immutable inheritance and an example for __new__().
class IntWrapper(int):
''' int wrapper class. Example for use of __new__().'''
_valmod5 = None
def __new__(cls, value):
''' Do something to differentiate from int.'''
self = int.__new__(cls, value) # create an immutable
return self
@stangirala
stangirala / Some Random Thread Example
Created January 28, 2013 03:48
A random thread example.
public class AsyncHelloWorld {
public static void main(String[] args) {
Thread InterfaceExample = new Thread(new PrintString("Thread 1"));
Thread ThreadExample = new PrintStringThread("Thread 2");
InterfaceExample.start();
@stangirala
stangirala / gist:4538893
Last active December 11, 2015 03:38
A poem that I find very interesting in the context of learning and the infinite monkey theorem. Blogged about it here, http://incodeitrust.wordpress.com/2013/01/15/the-paradox-of-intelligentsia/
Finding solace in words, in hope tailored.
Seeking faith in ability, in searching for a shroud,
to veil over what the eyes can see.
A guise to calm the restless mind, to soothe ego.
A mask over a white face, a scared soul.
Confidence shattered, finding solace in unreal pleasures.
A mind wasted, a heart lost.
Permanent waves, soon forgotten.
The elements come together and then vanish,
for progress is what mattered,
@stangirala
stangirala / gist:4441195
Created January 3, 2013 06:09
Setting up colour for url links on a CV in \latex.
\definecolor{blueblack}{rgb}{0.0,0.0,0.3}
\hypersetup{colorlinks,breaklinks,linkcolor=blueblack,urlcolor=blueblack,anchorcolor=blueblack,citecolor=blueblack}
# -*- coding: utf-8 -*-
"""
Builds epub book out of Paul Graham's essays: http://paulgraham.com/articles.html
Author: Ola Sitarska <ola@sitarska.com>
Copyright: Licensed under the GPL-3 (http://www.gnu.org/licenses/gpl-3.0.html)
This script requires python-epub-library: http://code.google.com/p/python-epub-builder/
"""