Skip to content

Instantly share code, notes, and snippets.

View pramttl's full-sized avatar

Pranjal Mittal pramttl

View GitHub Profile
@Susensio
Susensio / profiling_qcachegrind.sh
Last active February 10, 2024 07:53
Python profiling with QCacheGrind
# Profile with cProfile python module and save to output
python -m cProfile -o output.cprof script.py
# Transform into tree format for QCacheGrind
pyprof2calltree -i output.cprof -o callgrind.cprof
# Open QCacheGrind and load callgrind.cprof file
@nileshk
nileshk / app.conf
Created February 2, 2018 02:48
supervisord config for Django + pyenv + pyenv-virtualenv + gunicorn
[program:_appname_]
command = /home/_username_/.pyenv/versions/venvname/bin/gunicorn -w 1 -b 127.0.0.1:8000 --pythonpath=. --reload wsgi:application
directory=/home/_username_/sites/_appname_/
environment=PATH="/home/_username_/.pyenv/versions/venvname/bin:/home/_username_/.pyenv/shims:/home/_username_/.pyenv/bin:",DJANGO_SETTINGS_MODULE="_appname_.settings",HOME="/home/_username_"
user=_username_
autostart=true
autorestart=true
redirect_stderr=true
stopsignal=QUIT
stderr_logfile=/home/_username_/log/_appname_-stderr.log
@subfuzion
subfuzion / curl.md
Last active July 25, 2024 08:53
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@staltz
staltz / introrx.md
Last active July 29, 2024 05:55
The introduction to Reactive Programming you've been missing
@pbanaszkiewicz
pbanaszkiewicz / gist:11292070
Created April 25, 2014 14:45
Peer instruction on the Web - an accepted proposal for Mozilla (Google Summer of Code 2014)

Peer instruction on the Web

Abstract

Currently no MOOCs (Massive Open Online Courses) or e-learning systems support a peer instruction method, which has shown some advantages over traditional lecture-based learning techniques. In this project I will implement a tool that helps instructors and their students experiment with this teaching method online. The project will mainly leverage `WebRTC`_ technology.

## credit: http://fabian-affolter.ch/blog/the-lineinfile-module-of-ansible/
---
- hosts: alpine_install
user: root
tasks:
# - name: create a complete empty file
# command: /usr/bin/touch /test/test.conf
- name: create a new file with lineinfile
@wadey
wadey / iterm2.zsh
Last active July 21, 2024 06:00
Change iTerm2 tab color when using SSH
# Usage:
# source iterm2.zsh
# iTerm2 tab color commands
# https://iterm2.com/documentation-escape-codes.html
if [[ -n "$ITERM_SESSION_ID" ]]; then
tab-color() {
echo -ne "\033]6;1;bg;red;brightness;$1\a"
echo -ne "\033]6;1;bg;green;brightness;$2\a"
@ymirpl
ymirpl / gist:1052094
Created June 28, 2011 20:21
Python unicode e-mail sending
#coding: utf-8
from cStringIO import StringIO
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.header import Header
from email import Charset
from email.generator import Generator
import smtplib
# Example address data