Skip to content

Instantly share code, notes, and snippets.

@mitrofun
mitrofun / nginx.conf
Created August 17, 2017 07:58 — forked from steve-ng/nginx.conf
Nginx reverse proxy wss with ssl
server {
listen 443 ssl;
server_name xxx.xx.io
ssl on;
ssl_certificate /etc/asterisk/certs/xxx.io.pem;
ssl_certificate_key /etc/asterisk/certs/xxx.io.key;
ssl_session_timeout 5m;
@mitrofun
mitrofun / pytest_django.py
Created September 2, 2017 07:30 — forked from flub/pytest_django.py
pytest-django experiment
"""pytest plugin for testing django projects
This plugin handlers creating and destroying the test environment and
database. It is only enabled when DJANGO_SETTINGS_MODULES is set in
either the environment, the ini file or a conftest.py file. In case
of conftest.py files the django modules are only imported at the last
possible moment and it is also possible to test multiple sites
(multiple django settings modules) in one py.test process.
Similar to Django's TestCase, a transaction is started and rolled back
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import styles from './index.sass';
class TextField extends Component {
render () {
const { type, placeholder, ...rest} = this.props;
return (
<input
@mitrofun
mitrofun / iterm2-solarized.md
Created September 18, 2017 09:52 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@mitrofun
mitrofun / autoreload-Gunicorn
Created September 23, 2017 08:45 — forked from fprieur/autoreload-Gunicorn
Auto Reload Gunicorn On File Change Event
pip install watchdog -U
# now there is a command called "watchmedo", you'll like it...
# in terminal #1, run:
gunicorn app:myapp --pid=gunicorn.pid
# in terminal #2, run:
watchmedo shell-command \
--patterns="*.py;*.html;*.css;*.js" \
--recursive \
@mitrofun
mitrofun / nginx.conf
Created September 25, 2017 23:19 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@mitrofun
mitrofun / pyenv+direnv on OSX.md
Created October 4, 2017 08:30 — forked from alexhayes/ pyenv+direnv on OSX.md
Awesomely easy virtualenvs on OSX using pyenv and direnv

Awesomely easy virtualenvs on OSX using pyenv and direnv

Never forget to activate that virtualenv or set that environment variable ever again...

Install

  1. Install pyenv

     brew install pyenv
    
@mitrofun
mitrofun / dummy-web-server.py
Created October 6, 2017 22:22 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost
@mitrofun
mitrofun / urls.py
Created October 13, 2017 18:04 — forked from tauzen/urls.py
Example of using login_required and staff_member_required decorators with Class-based views in Django.
from django.conf.urls import patterns, include, url
from django.contrib.auth.decorators import login_required
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib import admin
from application.views import ApplicationFormView, ApplicationListView
admin.autodiscover()
urlpatterns = patterns('',
@mitrofun
mitrofun / backendData.js
Created November 21, 2017 15:14 — forked from Qt-dev/backendData.js
An accordion in ReactJS/CSS3
var backendData = [
{
"title":"Section 1",
"content":"Our content for the section 1"
},
{
"title":"Section 2",
"content":"Our content for the section 2"
},
{