Skip to content

Instantly share code, notes, and snippets.

View shashankgroovy's full-sized avatar
🏁
Godspeed

Shashank Srivastav shashankgroovy

🏁
Godspeed
View GitHub Profile
@shashankgroovy
shashankgroovy / gist:1461906
Created December 11, 2011 18:18 — forked from jamescasbon/template.py
Pure python templates using with statement
"""
A really stupid python template language inspired by coffeekup, markaby.
Do not use this code, it will ruin your day. A byproduct of insomnia.
TL;DR
-----
This module defines a template language that allows us to do:
d = Doc()
<a href="" class="button_holder">
<span class="f1">
<span class="f2">
<span class="f3">
<img src="http://picbox.im/image/7f1b604490-off.png">
</span>
</span>
</span>
</a>

Programming Achievements: How to Level Up as a Developer

  1. Select a particular experience to pursue.
  2. Pursue that experience to completion. (Achievement unlocked!)
  3. Reflect on that experience. Really soak it in. Maybe a blog post would be in order?
  4. Return to Step 1, this time selecting a new experience.

This gist is a fork of the gist from this blog post.

#define _XOPEN_SOURCE 500 /* Enable certain library functions (strdup) on linux. See feature_test_macros(7) */
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>
struct entry_s {
char *key;
char *value;
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@shashankgroovy
shashankgroovy / nginx-setup.sh
Last active February 12, 2016 12:50
Script to automatically create all nginx configurations
#!/bin/bash
# Description:
# Nginx configurations
# Execution:
# First a lot the correct file permissions for the setup file:
# $ chmod 755 setup.sh
# And then simply run
#!/bin/bash
# Description:
# EC2 setup.
# Based on Ubuntu, debian based systems
# Execution:
# First a lot the correct file permissions for the setup file:
# $ chmod 755 setup.sh
@shashankgroovy
shashankgroovy / gist:a8f8394b890753a0e678971eeb9282a6
Created July 27, 2016 09:30 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
  1. General Background and Overview
@shashankgroovy
shashankgroovy / graphs.py
Created July 29, 2016 05:46 — forked from prakhar1989/graphs.py
Simple Graph Algos
from collections import deque
from sys import maxint as MAXINT
# Breadth first search
def bfs(graph, start):
explored, queue = set([start]), deque([start])
while len(queue):
vertex = queue.popleft()
yield vertex
for neighbor in graph[vertex]: