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 / 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"
@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:

@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

@ignatev
ignatev / purge-nexus.groovy
Created December 10, 2018 16:25 — forked from bknopper/purge-nexus.groovy
Groovy script for Nexus 3 to purge old releases
import org.sonatype.nexus.repository.storage.StorageFacet;
import org.sonatype.nexus.repository.storage.Query;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
def fmt = DateTimeFormat.forPattern('yyyy-MM-dd HH:mm:ss');
[
'releases'
].each { reponame ->
// Get a repository
@ignatev
ignatev / README.md
Created December 6, 2018 11:22 — forked from dnozay/_Jenkins+Script+Console.md
jenkins groovy scripts collection.
@ignatev
ignatev / cleanupJenkinsWorkspaces.groovy
Created November 21, 2018 14:02 — forked from EvilBeaver/cleanupJenkinsWorkspaces.groovy
A jenkins script to clean up workspaces on slaves
// Check if a slave has < 10 GB of free space, wipe out workspaces if it does
import hudson.model.*;
import hudson.util.*;
import jenkins.model.*;
import hudson.FilePath.FileCallable;
import hudson.slaves.OfflineCause;
import hudson.node_monitors.*;
@ignatev
ignatev / openssl-cheat.sh
Created November 13, 2018 13:48 — forked from alvarow/openssl-cheat.sh
OpenSSL and Keytool cheat sheet
# Generate a new key
openssl genrsa -out server.key 2048
# Generate a new CSR
openssl req -sha256 -new -key server.key -out server.csr
# Check certificate against CA
openssl verify -verbose -CApath ./CA/ -CAfile ./CA/cacert.pem cert.pem
# Self Signed