Skip to content

Instantly share code, notes, and snippets.

View ignatev's full-sized avatar
🚍
bus_factor := ∞

Iskander Ignatev ignatev

🚍
bus_factor := ∞
View GitHub Profile
@ignatev
ignatev / postgres_queries_and_commands.sql
Created October 3, 2023 14:21 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), 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(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@ignatev
ignatev / ubuntu-server-setup-ifupdown.md
Created June 1, 2023 19:04 — forked from plembo/ubuntu-server-setup-ifupdown.md
Ubuntu Server Setup - with ifupdown

Ubuntu Server Setup - with ifupdown

The assumption here is that you're starting with a Ubuntu 20.04 LTS Server or newer, rather than Desktop, base (Ubuntu Desktop deploys NetworkManager rather than systemd-networkd by default).

The goal is networking configured for static addressing using using ifupdown, rather than the newer systemd-networkd and netplan, or (for Ubuntu Desktop) NetworkManager. It basically returns networking on Ubuntu to its Debian roots.

The physical network device name for the test machine was "ens3", it will be something else on different hardware.

NOTE: I am currently using netplan rather than ifupdown on my own Ubuntu servers. I'll keep these notes updated because the configuration is close enough to Debian that it may come in handy when I finally switch to Debian.

@ignatev
ignatev / Pipfile
Last active September 30, 2021 20:57
create_delete_maintenance_windows_pagerduty
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
pdpyras = "4.3.0"
[dev-packages]
@ignatev
ignatev / README.md
Created July 19, 2021 09:30 — forked from subfuzion/README.md
vim/neovim configuration

I recently switched over to neovim (see my screenshots at the bottom). Below is my updated config file.

It's currently synchronized with my .vimrc config except for a block of neovim-specific terminal key mappings.

This is still a work in progress (everyone's own config is always a labor of love), but I'm already extremely pleased with how well this is working for me with neovim. While terminal mode isn't enough to make me stop using tmux, it is quite good and I like having it since it simplifies my documentation workflow for yanking terminal output to paste in a markdown buffer.

These days I primarily develop in Go. I'm super thrilled and grateful for fatih/vim-go,

@ignatev
ignatev / Create-Administrator.ps1
Last active February 4, 2024 04:30 — forked from ducas/Create-Administrator.ps1
Create a local administrator account using PowerShell
#Better way:
New-LocalUser -AccountNeverExpires:$true -Password ( ConvertTo-SecureString -AsPlainText -Force 'somepassword') -Name 'someuser' | Add-LocalGroupMember -Group administrators
#Old:
$Username = "su"
$Password = "password"
$group = "Administrators"
$adsi = [ADSI]"WinNT://$env:COMPUTERNAME"
#
# Cookbook:: psaas-cookbook
# Recipe:: image-builder-base
#
# Copyright:: 2019, The Authors, All Rights Reserved.
ruby_block 'refreshenv' do
block do
refresh_env
end
@ignatev
ignatev / readme.md
Created May 14, 2020 10:39 — forked from maxivak/readme.md
Chef. How to run scripts (recipes)

Run Chef scripts locally

There are several options to run recipes:

  • using chef-client with -z option
  • using chef-apply
  • using chef-solo

Before running Chef recipes on the machine, it should be prepared:

Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
Enable-RemoteDesktop
cinst chef-client -y
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDP/8+8DG91rml2uqmstby4169Tn4P694Nu5ZmSYlIU6PMb1UAijGtOqbT46axh9pXZOGbtjao084rZfPgHJQcwuBqrTMBuGLjRJ4Kv2k2ZNenVa6glBerqw5YUaHZDAPb5hqhrDh4FjtvP3Rflgm03lbXK6kRbTwWJfBgoNu/JsJfZ5azcLYhjeX1UOM6s4ZXxlOM+/UYZ4OdAYGCZTPNmUgJ4dwUXtkU9mwz+WbMJctU0C4XWkD7oniBXQ4vNOJGAHVBVg1OakGtUgvsUkjbX531gkkUJUHZXV68ByUko5EMEetcb0yVk+meac8yoht+3/dDVLLIiMCg9ZsYxnsV5IaLRisvdFn92qWw1v659Iz3kkoEekw0vTEx9P0BBxefDweQNxuMWJysMKGNYL7vgR9IO55w5zgNsZuSUxQFova2L5+Oi1v/HJ1j9TsJC9YRe4AT+MC/J/GPdVDuwM+ZMNdxyx+68iBdUSZOye4gTT9yoV8KB0elplb+nrdPh55s=
@ignatev
ignatev / nginxproxy.md
Created March 21, 2019 12:21 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers