Skip to content

Instantly share code, notes, and snippets.

View anuriq's full-sized avatar

Azat Khadiev anuriq

  • Ozon
  • Moscow, Russia
View GitHub Profile
#!/var/lib/trove/venv/1.6.5/bin/python
def LOG(msg):
print msg
class Connection(object):
"""ClickHouse client wrapper"""
def __init__(self, username):
self.username = username
swagger: "2.0"
info:
title: Metrics API
description: API reference for metrics. Root is https://some.server:{port}/v1/{tenant}/
version: 1.0.0
host: some.server
schemes:
- https
basePath: /v1/
psql -h 89.208.87.38 -U admin -d myproddb
Password for user admin:
psql (11.1, server 10.7)
Type "help" for help.
myproddb=> CREATE TABLE log (event_id integer NOT NULL);
CREATE TABLE
myproddb=> INSERT INTO log VALUES (1),(2),(3);
INSERT 0 3
myproddb=> SELECT * FROM log;
cat <<EOF > pgc10.json
{"cluster":{"name":"postgres10","allow_remote_access":true,"datastore":{"type":"postgresql","version":"10"},"databases":[{"name":"myproddb"}],"users":[{"databases":[{"name":"myproddb"}],"name":"admin","password":"P@ssw0rd"}],"instances":[{"key_name":"shared","availability_zone":"DP1","flavorRef":"d659fa16-c7fb-42cf-8a5e-9bcbe80a7538","nics":[{"net-id":"b91eafed-12b1-4a46-b000-3984c7e01599"}],"volume":{"size":50,"type":"DP1"}},{"key_name":"shared","availability_zone":"DP1","flavorRef":"d659fa16-c7fb-42cf-8a5e-9bcbe80a7538","nics":[{"net-id":"b91eafed-12b1-4a46-b000-3984c7e01599"}],"volume":{"size":50,"type":"DP1"}},{"key_name":"shared","availability_zone":"DP1","flavorRef":"d659fa16-c7fb-42cf-8a5e-9bcbe80a7538","nics":[{"net-id":"b91eafed-12b1-4a46-b000-3984c7e01599"}],"volume":{"size":50,"type":"DP1"}}]}}
EOF
curl -s -H "X-Auth-Token: $OS_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d @pgc10.json https://infra.mail.ru:8779/v1.0/ce2a41bbd1434013b85bdf0
from __future__ import print_function
from datetime import datetime
from random import randint
from time import sleep
import psycopg2
def main():
try:
codes_file = open('C:\\Users\\udmin\\Documents\\sources.txt')
codes_list = codes_file.readlines()
codes_list2 = []
for c in codes_list: codes_list2.append(c.split(','))
target_file = open('C:\\Users\\udmin\\Documents\\list.txt')
target_list = [x.strip() for x in target_file.readlines()]
$ knife bootstrap windows ssh -x Administrator -P <mypassword> --secret-file ~/.chef/data_bag_secret --policy-group production --policy-name <mypolicy> -N <myfqdn> <myfqdn> -VV
INFO: Using configuration from /Users/akhadiev/.chef/knife.rb
DEBUG: Looking for key chef_node_name and found value <myfqdn>
DEBUG: Chef::HTTP calling Chef::HTTP::JSONInput#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::JSONOutput#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::CookieManager#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::Decompressor#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::Authenticator#handle_request
DEBUG: Signing the request as akhadiev

Keybase proof

I hereby claim:

  • I am anuriq on github.
  • I am anuriq (https://keybase.io/anuriq) on keybase.
  • I have a public key whose fingerprint is 5DAC B7D0 809B 196A 2F5E E93E EB31 FF47 EFE0 C68B

To claim this, I am signing this object:

function Get-PendingReboot {
<#
.SYNOPSIS
Gets the pending reboot status on a local or remote computer.
.DESCRIPTION
This function will query the registry on a local or remote computer and determine if the
system is pending a reboot, from either Microsoft Patching or a Software Installation.
For Windows 2008+ the function will query the CBS registry key as another factor in determining
pending reboot state. "PendingFileRenameOperations" and "Auto Update\RebootRequired" are observed
@anuriq
anuriq / windowsfeatures2.xml
Created February 2, 2016 10:57
this time with FTP
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04">
<Obj RefId="0">
<TN RefId="0">
<T>System.Collections.ObjectModel.Collection`1[[System.Management.Automation.PSObject, System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]</T>
<T>System.Object</T>
</TN>
<LST>
<Obj RefId="1">
<TN RefId="1">
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_NET_Framework_45_ASPNET</T>