Skip to content

Instantly share code, notes, and snippets.

View smith3v's full-sized avatar

Slava Kuznetsov smith3v

View GitHub Profile
@smith3v
smith3v / pg_stat_activity
Created August 29, 2019 13:24
Query to look the current activity in PG cluster
select (now() - query_start), datname, pid, usename, client_addr, client_port, state, CASE WHEN char_length(query) > 244 THEN substring(query, 1, 200) || ' .. ' || substring(query FROM '.{200}$') ELSE query END AS short_query from pg_stat_activity;
@smith3v
smith3v / HangOps_ru-170512.md
Created May 12, 2017 04:39
HangOps_ru 12.05.17 ZFS, openresty - чаты

YouTube chat

HangOps_ru​Привет всем.

Sergey Ovsienko​хай

Sergey Ovsienko​начинайте, а то трубы горят

Vyacheslav Kuznetsov​еще собираемся

@smith3v
smith3v / HangOps_ru-170427.md
Last active May 2, 2017 08:58
HangOps_ru 27.04.17 DevOps VS or and ITIL - чаты

Hangout

Дмитрий Малыхин 10:07 PM http://i.imgur.com/DFCuIfl.jpg

me 10:28 PM ITIL только у меня вызывает ощущение дикой бюрократии?

Дмитрий Малыхин 10:28 PM нет. а ДевОпс анархия ?

Keybase proof

I hereby claim:

  • I am smith3v on github.
  • I am smith3v (https://keybase.io/smith3v) on keybase.
  • I have a public key ASBZRvQPDdicavDwykI5-A1emoRfFpDukxMrpqz-835fpAo

To claim this, I am signing this object:

@smith3v
smith3v / resouce-related issue with chef 11.4.4
Created June 22, 2013 12:11
Resource-related issue with Chef 11.4.4
@smith3v
smith3v / sorting_dict_of_objects.py
Created August 13, 2012 04:02
Sorting a dict by property of the stored object
stats = Dict()
class Stats:
""" A class to keep some stats """
def __init__(self):
self.prop1 = 0
self.prop2 = 0
# Filling the dict with objects
@smith3v
smith3v / server start
Created June 21, 2012 18:28
A bug in knife-ec2
$ knife ec2 server create --groups sg-4e63c727
ERROR: Fog::Compute::AWS::NotFound: The security group 'sg-4e63c727' does not exist
@smith3v
smith3v / rename-node.rb
Created June 3, 2012 19:25 — forked from jtimberman/rename-node.rb
A knife exec script to change Chef node's name.
#!./bin/knife exec
# A knife exec script to change chef node's name, preserving all the attributes.
#
# Usage: knife exec rename-node.rb old-name new-name
#
# Script retrieves the Node object, changes its 'name' attribute,
# creates new Node object with updated name and rest of attributes
# untouched. Then it deletes old Node and Client objects from
# database, and logs into the server to update it:
@smith3v
smith3v / com.apple.fuse4x.plist
Created May 13, 2012 07:32
run fuse4x.kext on system start
<plist version="1.0"><dict><key>KeepAlive</key>
<false>
<key>Label</key>
<string>com.apple.fuse4x</string>
<key>ProgramArguments</key>
<array>
<string>//sbin/kextload</string>
<string>/System/Library/Extensions/fuse4x.kext</string>
</array>
<key>RunAtLoad</key>
def run_pg_fouine():
info = host_info[env.host_string]
db_name = info.tags.get('Name')
sudo('perl -pi -e "s/log_min_duration_statement = .*/log_min_duration_statement = 0/" /etc/postgresql/9.*/main/postgresql.conf')
sudo('/etc/init.d/postgresql reload')
time.sleep(30)
sudo('perl -pi -e "s/log_min_duration_statement = .*/log_min_duration_statement = 500/" /etc/postgresql/9.*/main/postgresql.conf')
sudo('/etc/init.d/postgresql reload')
run('tail -n 100000 /var/log/postgresql/postgresql-9.*-main.log > /tmp/pgfouine.txt')
run('gzip -f /tmp/pgfouine.txt')