Skip to content

Instantly share code, notes, and snippets.

@vladsimachkov
vladsimachkov / flask_dump_request_response.py
Created June 6, 2021 06:26 — forked from TheWaWaR/flask_dump_request_response.py
Flask dump request and response example
#!/usr/bin/env python
# coding: utf-8
import os
import sys
import json
import uuid
import tempfile
from flask import Flask, request, Response, g
@vladsimachkov
vladsimachkov / README.md
Created April 23, 2019 21:09
How to setup a Oracle 12c database on DigitalOcean

Step 0:

Start downloading the install files from Oracle

Step 1:

Create a blank CentOs 6.5 instance

Convert to Oracle Linux: (source)

curl -O https://linux.oracle.com/switch/centos2ol.sh 
sh centos2ol.sh

cd ~/Downloads

wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+xenial_all.deb

dpkg -i zabbix-release_3.2-1+xenial_all.deb

apt-get update

should add /etc/apt/sources.list.d/zabbix.list

@vladsimachkov
vladsimachkov / tornado-server.md
Created February 19, 2017 12:31 — forked from chen206/tornado-server.md
tornado server, ubuntu 12.04.2, mysql5.5, python2.7, tornado2.4.1, virtualenv, celery3.0.19, redis2.7.4, mongo

AptGet source.list

/etc/apt/source.list

deb http://cn.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://cn.archive.ubuntu.com/ubuntu/ precise main restricted

deb http://cn.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb-src http://cn.archive.ubuntu.com/ubuntu/ precise-updates main restricted
@vladsimachkov
vladsimachkov / main.py
Created February 19, 2017 11:43 — forked from alejandrobernardis/main.py
Tornado // Python 3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 Asumi Kamikaze Inc.
# Copyright (c) 2013 The Octopus Apps Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
#
# Author: Alejandro M. Bernardis
# Email: alejandro.m.bernardis at gmail.com
# Created: 4/6/13, 12:44 PM
@vladsimachkov
vladsimachkov / graceful_shutdown_tornado_web_server.py
Created October 3, 2016 02:35 — forked from mywaiting/graceful_shutdown_tornado_web_server.py
The example to how to shutdown tornado web server gracefully...
#!/usr/bin/env python
"""
How to use it:
1. Just `kill -2 PROCESS_ID` or `kill -15 PROCESS_ID` , The Tornado Web Server Will shutdown after process all the request.
2. When you run it behind Nginx, it can graceful reboot your production server.
3. Nice Print in http://weibo.com/1682780325/zgkb7g8k7
"""
@vladsimachkov
vladsimachkov / tornado-unix-socket.py
Created September 3, 2016 21:11 — forked from wklken/tornado-unix-socket.py
Tornado web server with unix socket support
import tornado.ioloop
import tornado.web
from tornado.options import options, define
from tornado.netutil import bind_unix_socket
from tornado.httpserver import HTTPServer
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
@vladsimachkov
vladsimachkov / bbb_boot_service_instructions.md
Created August 29, 2016 12:44 — forked from tstellanova/bbb_boot_service_instructions.md
How to setup a service to automatically run a python script when the BeagleBone Black (BBB) reboots. These instructions allow you to setup a python script to automatically start when the BeagleBone (running Angstrom linux with systemd) restarts.

Creating a service to startup at BeagleBone Black boot time:

  • Create a shell script such as /usr/bin/myFancyBash.sh:

      #!/bin/bash
    
      # this could be any runnable code or shell script, really
      /usr/bin/myFancyPython.py 
    

Note that the first line is critical.