Skip to content

Instantly share code, notes, and snippets.

View vakhov's full-sized avatar
💭
learn new

Alex Vakhov vakhov

💭
learn new
View GitHub Profile
@vakhov
vakhov / maps_url.py
Created July 2, 2021 10:40 — forked from willcharlton/maps_url.py
Python (3) snippet to generate google maps url and timezone for a given address.
#!/usr/bin/env python3
"""
So far only tested on python3 interpreter.
Given an address, this script outputs a google maps url to the address.
"""
import requests, sys, time
from urllib.parse import quote_plus
@vakhov
vakhov / gitcheats.txt
Created January 22, 2020 04:32 — forked from chrismccoy/gitcheats.txt
git cheats
# shortform git commands
alias g='git'
# git remote all remotes except origin
git remote -v | grep "(fetch)" | sed -e 's#[[:blank:]].*##g' | grep -v "origin" | xargs -n 1 git remote rm
# print all git repos for a user
curl -s https://api.github.com/users/wordpress/repos?per_page=1000 | grep git_url |awk '{print $2}'| sed 's/"\(.*\)",/\1/'
# print all git repos for a user
@vakhov
vakhov / Gunicorn.sh
Created June 28, 2019 11:00 — forked from omedhabib/Gunicorn.sh
Gunicorn.sh
#!/usr/bin/env bash
PROCESSOR_COUNT=$(nproc)
GUNICORN_WORKER_COUNT=$(( PROCESSOR_COUNT * 2 + 1 ))
gunicorn -w ${GUNICORN_WORKER_COUNT} -b 0.0.0.0:9808 app:application
#! C:\python2.7
# -*- coding: utf-8 -*-
# Написать декоратор мемоизирующий мат-функцию.
def cache(func):
"""
инициализируем словарь, ключем которого будет
переданный аргумент функции
"""
cache_all = {}
cache_all[func] = {}
@vakhov
vakhov / gist:cd9180035792fe405456d8a13df0981a
Created June 6, 2019 10:20 — forked from sweenzor/gist:2933958
Kill all celery tasks (redis)
# nuke the queue
redis-cli FLUSHALL
# nuke anything currently running
pkill -9 celeryd
@vakhov
vakhov / gunicorn_start.bash
Created May 30, 2019 10:22 — forked from postrational/gunicorn_start.bash
Example of how to set up Django on Nginx with Gunicorn and supervisordhttp://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/
#!/bin/bash
NAME="hello_app" # Name of the application
DJANGODIR=/webapps/hello_django/hello # Django project directory
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket
USER=hello # the user to run as
GROUP=webapps # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name
@vakhov
vakhov / nginx-socketio-ssl-reverse-proxy.conf
Created May 28, 2019 11:51 — forked from gmanau/nginx-socketio-ssl-reverse-proxy.conf
How to setup nginx as nodejs/socket.io reverse proxy over SSL
upstream upstream-apache2 {
server 127.0.0.1:8080;
}
upstream upstream-nodejs {
server 127.0.0.1:3000;
}
server {
listen 80;
@vakhov
vakhov / setup-tor.md
Created March 24, 2019 06:48 — forked from skippednote/setup-tor.md
Setup Tor on macOS

Setup One: Buy a Mac if you don't have one.

Setup Two: Install Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Setup Three: