Skip to content

Instantly share code, notes, and snippets.

@ksalyamov
ksalyamov / server.py
Created October 25, 2021 12:50 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
class S(BaseHTTPRequestHandler):
@ksalyamov
ksalyamov / vim_cheatsheet.md
Last active May 10, 2018 15:38 — forked from awidegreen/vim_cheatsheet.md
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
Alt + Home = Navigation Bar
Alt + Ctrl + Shift + N = Search by symbols
Shift x2 = Last open files
F11 = Add anonymous bookmark
Ctrl + F11 = Add named bookmark
Shift + F11 = View all bookmark
Alt + Shift + F9 = Run debug
Alt + F = Distraction Free Mode (Custom shortcut)
Alt + Insert = Create New (class, module, file, etc)
Ctrl + Shift + Space = Smart autocomplete
@ksalyamov
ksalyamov / upgrade_ibus_1.5.md
Created February 9, 2018 18:24 — forked from jpina/upgrade_ibus_1.5.md
Upgrade ibus to 1.5 in Ubuntu 14.04

Upgrade ibus to v1.5.x in Ubuntu 14.04

Install dependencies

sudo apt-get update -qq
sudo apt-get install -y gtk+-2.0 gtk+-3.0
sudo apt-get install -y libdconf-dev libnotify-dev
sudo apt-get install -y libdbus-1-dev
@ksalyamov
ksalyamov / postgres-import-export-csv.md
Created February 1, 2018 11:34 — forked from nepsilon/postgres-import-export-csv.md
Importing and Exporting CSV files with PostgreSQL — First published in fullweb.io issue #19

Importing and exporting CSV files with PostgreSQL

Let’s see how to use PostgreSQL to import and export CSV files painlessly with the COPY command.

Import CSV into table t_words:

COPY t_words FROM '/path/to/file.csv' DELIMITER ',' CSV;

You can tell quote char with QUOTE and change delimiter with DELIMITER.

@ksalyamov
ksalyamov / postgres_queries_and_commands.sql
Created October 21, 2016 20:05 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@ksalyamov
ksalyamov / bookmarks.md
Created August 1, 2016 05:20 — forked from boneskull/bookmarks.md
How to use Mercurial bookmarks

How to Use Mercurial Bookmarks

Note: This document is specific to the FocusVision development environment, however it's mostly applicable elsewhere.

by Christopher Hiller

Mercurial branches are not "cheap". Unlike Git, to create or destroy a branch, you actually have to commit a changeset to the repository. Branches are great for…something…but whatever that is, we're not doing it.

Enter Bookmarks.