Skip to content

Instantly share code, notes, and snippets.

View maksimKorzh's full-sized avatar
💭
Freelancer and Blogger

Code Monkey King maksimKorzh

💭
Freelancer and Blogger
View GitHub Profile
@maksimKorzh
maksimKorzh / notepad.py
Created October 5, 2019 14:23
Minimalist python tkinter text editor
#
# Simple code editor with syntax highlighting
#
# import Libraries
import tkinter as tk
from tkinter import ttk
from tkinter import filedialog
# create new file
@maksimKorzh
maksimKorzh / copy_remote_files.py
Created October 2, 2019 08:35 — forked from mariusavram91/copy_remote_files.py
Copy remote files to local with Python's Paramiko
import os
import paramiko
paramiko.util.log_to_file('/tmp/paramiko.log')
paramiko.util.load_host_keys(os.path.expanduser('~/.ssh/known_hosts'))
host = 'local'
port = 22
username = 'user'
files = ['file1', 'file2', 'file3', 'file4']
# login to heroku
heroku login
# init empty repo
git init
# create app
heroku create your-first-heroku-app --buildpack heroku/python
# add remote git
# install pip
sudo apt-get update
sudo apt-get install python3-pip
sudo pip3 install setuptools
sudo pip3 install wheel
# install requests
sudo pip3 install requests
# install beautiful soup
# initial user setup
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
@maksimKorzh
maksimKorzh / app_pagination.py
Last active December 7, 2019 19:50 — forked from mozillazg/app.py
A simple demo for how to use flask-paginate.
from flask import Flask, render_template
from flask_paginate import Pagination, get_page_args
app = Flask(__name__)
app.template_folder = ''
users = list(range(100))
def get_users(offset=0, per_page=10):
from flask import Flask, request, jsonify
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow
import os
# init app
app = Flask(__name__)
# SQLite database connection
########################################
#
# A simple binary Markov chain model
#
########################################
import random
import matplotlib, matplotlib.pyplot as plt
matplotlib.use('tkagg')
# general
SHOW DATABASES;
USE database_name;
SHOW TABLES;
SELECT * FROM table_name WHERE column_name LIKE "%search_keyword%";
SELECT * FROM table_name ORDER BY id_column LIMIT 10;
# create table
CREATE TABLE EMPLOYEE (
FIRST_NAME CHAR(20) NOT NULL,