Skip to content

Instantly share code, notes, and snippets.

@feanil
feanil / get_all_views.py
Last active August 30, 2023 15:19 — forked from Gautamaggrawal/get_all_views.py
GET ALL VIEWS IN DJANGO APP
from django.conf import settings
from django.urls import URLResolver, URLPattern
root_urlconf = __import__(settings.ROOT_URLCONF) # import root_urlconf module
all_urlpatterns = root_urlconf.urls.urlpatterns # project's urlpatterns
def get_all_view_names(urlpatterns):
views = []
for pattern in urlpatterns:
if isinstance(pattern, URLResolver):
@feanil
feanil / how-i-work-template.md
Created June 14, 2021 14:28 — forked from jazzsequence/how-i-work-template.md
Template for How I Like to Work posts

How I work

This is my own interpretation of how I like to work, feedback welcome! Especially if my own view of how I think I like to work doesn't match your experience of how it seems I like to work!

When I work

<html>
<head>
<style type="text/css">
body {
background: black;
}
</style>
</head>
<body>
<iframe width="100%" height="100%" src="https://www.youtube.com/embed/zuLqEgD3T-Y?wmode=opaque&autoplay=1&loop=1" frameborder="0" allowfullscreen></iframe>
@feanil
feanil / keybase.md
Created March 24, 2016 16:12
keybase.md

Keybase proof

I hereby claim:

  • I am feanil on github.
  • I am feanil (https://keybase.io/feanil) on keybase.
  • I have a public key whose fingerprint is 6DCA 7732 7D64 9F11 80EE DE63 F321 A759 2630 158D

To claim this, I am signing this object:

#rancheros cloud-config
hostname: "blue"
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6PK4lsevO2t9bMdaue+M6i+dVCPN6/hDkOXVPa3MNAGHh1ncVQI/lyEpfcba/f5wY1PC5PyvSVnwbTVI0PHky8y2qJe2eCInG6j4HcOd0rzJagRrmGLmGCXZEhrpje9V4txf8+EggPZW2zN2oB4aJW8G8kmZyoHpwn1Xkdrs1N5Ay+ubPMbCX7ZzcRG/ftcPz/wTfk15Iioh+oHIu1IAUgzgkiOYXun8pe8//xBfTAudRT1jqWUyT9U0NkPs9OS9oOYIpBwXYeNAObfUbk86e4jStx2ljq0qPTNYwZIt/e5JOlPil9p3reoR3jxK5cAWn53mP7CEHnh74vcsNlQ9fpUduJ5CwIQ4hklLTJkw+1oSd7fBbVGvMfYJytVxxzrl72y5pgdKdbeUegH24qehrlVUE1eObGlPUF5J5IdC2IAY+/qHQISAESn77sMhM+cD9/JCGZ9h6viKV3wx2OrSpukNzdPSTmjDbYty47vSFRqKHRgi1vEWyowq3k+EJdKNJO+jIARdcVI42amNhuGINeBlgfWlOlEj5ns5tpOCtSEkXVo0SuXiBFpqY4TbxZ2neUUW3yroMdDH2SziwzZXL8gODgwiMqh4OggU+Cs3bQwoi8CySBUBzYvaAzhmgosTYj+K275JD5MfjKw5Sem9f0IBxke9f+eIeO/DtKaUNJw== feanil@gmail.com
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCk5/wEsUe+pOXCSk49jOHYzycqfzlTVG/b3bj0qc5LlFIiftcOGIPNAKdvPjuMi8bB7fMUFZiKAaMu+OqeNHehqFKR+mZZlh2PiwwBQUB8O7h5E1a6VC6SuvF4Twxco/FLe/YoifC0QDvB3yvsON0sA4BQQPAZHGfKi9i1IoEywg8y
@feanil
feanil / gist:d76bc06b240e4db9084e
Last active January 9, 2016 00:33
MongoDB World

We need a way to setup a cluster for the first time. We need a way to add/remove nodes from the cluster

  • Jenkins jobs to cause the primary to stepdown.
  • Job for getting the node status for all nodes. Periodic Index Compaction would be good for performance
  • This way if devs add indices as part of the code(ensureIndex) we can still get perf improvements of a compact index Need a good pattern for manging indices
  • Ideally they would live in the app repos but it would be nice to automate their creation.
  • Maybe part of the AMI build would be to create indexes Maybe get an AMI for Mongo
@feanil
feanil / front_hub_spoke_length.txt
Last active December 25, 2015 13:09
Shimano Tiagra Front Hub Measurements
Over Lock Distance(OLD)(nut to nut): 100mm
Distance from Outside flange to outside flange: 71.75mm
Velocity DeepV 32h ERD(Effective Rim Diameter): 581mm
Flange Diameter(Hole Ceter to Hole Center): 37.31mm
Left Lock Nut to Outside of Flange: 14mm
Flange Width(Both Sides):3.23mm
Right Lock Nut to Qutside of Flange: 14.1mm
@feanil
feanil / gist:ad006ceb2d8f9a9a6cf2
Last active August 29, 2015 14:18
Thoughts from Pycon 2015

In an IDA world we need to think about heartbeats differently. ELB heartbeats should not result in the whole program faliing just because one of the services the app needs is unreachable.

  • Health check should fail only if the full IDA is un-usable

  • It should otherwise indicate problems on the health page but continue to do what we can.

  • Will we need to monitor differently? Want to know when things are sick not just when they're dead.

  • TEST/PLAT: How are we testing short-circuting right now? Any integration tests?

  • Metrics and Logging

    • Errors
      • Sentry tool for errors - Newrelic does the same sort of thing.
  • Grafana + Graphite or InfluxDB <- New tools

Performance Metrics To Capture
==============================
Pools and Queues
- Match the pools at various stages, gunicorn thread pool, db connection pool
- Key Metrics
- # of SQL Statements/Request
- # of same SQL executions
- Idle vs Busy Threads in the whole pipeline
Load Time
---
# Example sandbox configuration
# for single server community
# installs
- name: Configure instance(s)
hosts: all
sudo: True
gather_facts: True