Skip to content

Instantly share code, notes, and snippets.

@mitrofun
mitrofun / export_csv_action.py
Created June 2, 2019 21:30 — forked from bryanchow/export_csv_action.py
Django Export CSV admin action factory
# Django Export CSV admin action factory
# https://gist.github.com/1411467
#
# Based on http://djangosnippets.org/snippets/2020/
# and http://djangosnippets.org/snippets/1697/
#
# Example usage:
#
# class MyUserAdmin(admin.ModelAdmin):
# actions = (
@mitrofun
mitrofun / django_log_settings.py
Created May 4, 2019 22:38 — forked from st4lk/django_log_settings.py
Django logging settings
# Logging settings for django projects, works with django 1.5+
# If DEBUG=True, all logs (including django logs) will be
# written to console and to debug_file.
# If DEBUG=False, logs with level INFO or higher will be
# saved to production_file.
# Logging usage:
# import logging
# logger = logging.getLogger(__name__)
# logger.info("Log this message")
@mitrofun
mitrofun / pug.md
Created May 2, 2019 11:16 — forked from neretin-trike/pug.md
Туториал по HTML препроцессору Pug (Jade)
@mitrofun
mitrofun / flexbox.scss
Created May 1, 2019 22:56 — forked from richardtorres314/flexbox.scss
CSS Flexbox - Sass Mixins
// --------------------------------------------------
// Flexbox SASS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
@mixin flexbox() {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
@mitrofun
mitrofun / favicons.html
Created April 13, 2019 11:09 — forked from ianaya89/favicons.html
All Favicons for All Devices and Sizes
<link rel="shortcut icon" sizes="16x16 24x24 32x32 48x48 64x64" href="favicon.ico">
<!-- Mobile (Android, iOS & others) -->
<link rel="apple-touch-icon" sizes="57x57" href="favicon-57.png">
<link rel="apple-touch-icon-precomposed" sizes="57x57" href="favicon-57.png">
<link rel="apple-touch-icon" sizes="72x72" href="favicon-72.png">
<link rel="apple-touch-icon" sizes="114x114" href="favicon-114.png">
<link rel="apple-touch-icon" sizes="120x120" href="favicon-120.png">
<link rel="apple-touch-icon" sizes="144x144" href="favicon-144.png">
<link rel="apple-touch-icon" sizes="152x152" href="favicon-152.png">
@mitrofun
mitrofun / readme.md
Created April 8, 2019 08:48
npm install from public or private repos on GitHub or Bitbucket

Get the latest from GitHub, public repo:

$ npm install username/my-new-project --save-dev

GitHub, private repo:

$ npm install git+https://token:x-oauth-basic@github.com/username/my-new-project.git#master $ npm install git+ssh://git@github.com/username/my-new-project.git#master

… or from Bitbucket, public repo:

$ npm install git+ssh://git@bitbucket.org/username/my-new-project.git#master --save-dev

Bitbucket, private repo:

$ npm install git+https://username:password@bitbucket.org/username/my-new-project.git#master

@mitrofun
mitrofun / index.html
Created April 2, 2019 09:49 — forked from gaearon/index.html
Multiple React components on a single HTML page
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
</head>
<body>
<h2>Add React in One Minute</h2>
<p>This page demonstrates using React with no build tooling.</p>
@mitrofun
mitrofun / letsencrypt_2018.md
Created March 1, 2019 15:16 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@mitrofun
mitrofun / async_app.py
Created February 11, 2019 16:17 — forked from zbyte64/async_app.py
Asyncio Views With Django
import asyncio
from django import http
from django.core.urlresolvers import set_script_prefix
from django.utils.encoding import force_str
from django.core.handlers.wsgi import get_script_name
from django_wsgi.handler import DjangoApplication
import logging
import logging
import sys
@mitrofun
mitrofun / install_tesseract.sh
Created January 14, 2019 16:09 — forked from espinielli/install_tesseract.sh
install tesseract-ocr on a Mac
#!/usr/bin/env bash
# courtesy of : <https://ryanfb.github.io/etc/2014/11/13/command_line_ocr_on_mac_os_x.html>
# Check for Homebrew,
# Install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
# Ensure `homebrew` is up-to-date and ready