Skip to content

Instantly share code, notes, and snippets.

@shreyansb
shreyansb / docker-cheat-sheat.md
Created January 15, 2021 06:02 — forked from natbusa/docker-cheat-sheat.md
Docker Cheat Sheet

Build docker image

$ cd /path/to/Dockerfile
$ sudo docker build .

View running processes

@shreyansb
shreyansb / gist:85045f7f9007084628c1
Created June 13, 2015 19:44
setting up mosql on a fresh EC2 instance
# create new EC2 instance with ubuntu 14.04 LTS
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
sudo apt-get install ruby1.9.3
sudo apt-get install libpq-dev
sudo gem install mosql
import config
import redis as _redis
redis = _redis.Redis(host=config.REDIS_HOST, port=int(config.REDIS_PORT))
REDIS_KEY_PATTERN = "feed:%s:%s"
feed_key = lambda _type, _id: REDIS_KEY_PATTERN % (_type, _id)
DEFAULT_MAX_LENGTH = 1000
DEFAULT_LIMIT = 50
@shreyansb
shreyansb / gist:081b72580df2e08ef2c5
Created February 26, 2015 21:06
Converting Natural Earth's small scale land polygons to TopoJSON
brew install gdal
sudo npm install -g topojson
sudo npm install -g http-server
mkdir -p /socratic/geojson
cd /socratic/geojson
mkdir static static/shp static/json static/scripts
wget http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_land.zip -P static/shp/
unzip static/shp/ne_110m_land.zip -d static/shp/ne_110m_coastline
ogr2ogr -f GeoJSON static/json/landgeo.json static/shp/ne_110m_land/ne_110m_land.shp
topojson -o static/json/landtopo.json static/json/landgeo.json
from jinja2.environment import create_cache
# blah blah blah
app.jinja_env.cache = create_cache(1000)
# blah blah blah
app.run()
@shreyansb
shreyansb / flask_profiler.py
Last active January 11, 2024 12:08
A profiler for Flask apps
"""
This module provides a simple WSGI profiler middleware for finding
bottlenecks in web application. It uses the profile or cProfile
module to do the profiling and writes the stats to the stream provided
To use, run `flask_profiler.py` instead of `app.py`
see: http://werkzeug.pocoo.org/docs/0.9/contrib/profiler/
and: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvi-debugging-testing-and-profiling
"""
@shreyansb
shreyansb / gist:ff0c3a6820296d71404c
Created July 14, 2014 12:30
[Guitar tabs] Hallelujah
Standard Tuning
Intro: C Am C Am
C Am
I heard there was a secret chord
C Am
That David played and it pleased the lord
F G C G
But you don't really care for music, do you?
@shreyansb
shreyansb / index.html
Last active August 29, 2015 14:01
places I've lived
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
background: #00AEA0;
padding: 0px;
margin: 0px;
}
@shreyansb
shreyansb / gist:4b323f9839a2edc8ab7c
Created May 14, 2014 03:22
Services Engineering Reading List

via: services-engineering

Services Engineering Reading List

  • A reading list for services engineering, with a focus on cloud infrastructure services
  • Most content is on applied distributed systems and systems operations
  • Please send suggestions to @mmcgrana or open an issue

Papers

@shreyansb
shreyansb / gist:11275498
Created April 25, 2014 01:52
delete "/tmp/tmp.*" files older than 7 days
find /tmp -name "tmp.*" -mtime +7 -delete